List of custom filter hooks

The custom filter hooks can be used to modify specific parts of the theme.

You can use the Hook name in from the table below with the WordPress function add_filter to modify the given value. This is an advanced topic, if you are unsure consult a developer. See the examples below the table.

Hook Date type Description
tcr_status_avatar_size integer Default 65. The number passed to get_avatar in the Status post format template content-status.php
tcr_image_sizes array The extra image sizes supported by the theme. The default at the time of writing is:

array(
    'react-512' => array('name' => 'React 512', 'width' => 512, 'height' => 0, 'crop' => false),
    'react-768' => array('name' => 'React 768', 'width' => 768, 'height' => 0, 'crop' => false)
)
tcr_current_post object Default is the value returned by get_queried_object().
tcr_styles array The array of CSS stylesheets used by the theme, adding additional styles to this array means they will be automatically enqueued and can be combined/minified and enabled/disabled on the Theme Options → Advanced → Performance page. See framework.php::tcr_get_styles().
tcr_scripts array The array of JavaScript scripts used by the theme, adding additional scripts to this array means they will be automatically enqueued and can be combined/minified and enabled/disabled on the Theme Options → Advanced → Performance page. See framework.php::tcr_get_scripts().
tcr_favicon_sizes array The array of favicon sizes to automatically generate. The default is:

array(57,72,76,114,120,144,152,180)
tcr_page_layout string Default ‘pge-bxd’. The option at Theme Options → Design → Layout → Page layout type. Options are:

  • ‘pge-fld’ – Full width fluid
  • ‘pge-bxd-cnt’ – Full width content boxed
  • ‘pge-bxd’ – Boxed
  • ‘pge-mxd’ – Mixed
tcr_header_tophead_type string Default ‘th-thin’. The option at Theme Options → Global → Header → Top header type. Options are:

  • ‘th-thin’ – Thin
  • ‘th-med’ – Medium
  • ‘th-bold’ – Big
tcr_serene_options array The configuration array for the full screen lightbox script “Serene”. See this page for options.
tcr_background_image_url string The URL of the background image to display, loops through each of them before they are passed to the full screen background script.
tcr_background_options array The configuration array for the full screen background script. See this page for options.
tcr_head_contact_quform_id integer The form ID of the first Quform popup form in the header.
tcr_head_contact_quform_id_sales integer The form ID of the sales Quform popup form in the header.
tcr_head_contact_quform_id_support integer The form ID of the support Quform popup form in the header.
tcr_logo_link_url string The URL that the logo should link to.
tcr_contact_quform_id_infomenu integer The form ID of the Quform form to use in the Contact Info Menu item.
tcr_footer_end_page_popout string The text/HTML to display in the small pop-out box when the user scrolls to the footer of the page.
tcr_intro_title string The title text/HTML in the intro section.
tcr_intro_subtitle string The subtitle text/HTML in the intro section.
tcr_show_intro boolean Whether or not to display the intro section.
tcr_show_intro_devices array The array of which devices to show the intro on. See the array layout in theme.php::tcr_intro()
tcr_intro string The HTML of the intro section; shortcodes are parsed inside it
tcr_layout string The page layout, one of: ‘left-sidebar’, ‘full-width’, ‘right-sidebar’
tcr_video array The configuration array for background videos videos. See the array layout in theme.php::tcr_set_video_background().
tcr_video_vimeo array The configuration array for Vimeo background videos. See the array layout in theme.php::tcr_set_video_background().
tcr_video_youtube array The configuration array for YouTube background videos. See the array layout in theme.php::tcr_set_video_background().
tcr_audio array The configuration array for background audio. See the array layout in theme.php::tcr_set_audio_background().
tcr_blog_featured_image_type
tcr_page_featured_image_type
tcr_portfolio_featured_image_type
string The default is ‘above’. Sets the featured image type for these posts types in the blog page, archives and search results. Options are:

  • ‘below’ – Below title (full width)
  • ‘above’ – Above title (full width)
  • ‘left’ – Float left
  • ‘right’ – Float right
tcr_blog_featured_image
tcr_page_featured_image
tcr_portfolio_featured_image
boolean Enables or disables the featured image for these posts types in the blog page, archives and search results.
tcr_post_icon string Sets the FontAwesome icon to use for the current Post. See theme.php::tcr_post_icon()
tcr_video_info array Get the video type and ID from a YouTube / Vimeo URL. See theme.php::tcr_get_video_info()
tcr_get_sidebars array Get the array of theme sidebars. See widgets.php::tcr_get_sidebars()
tcr_sidebar string The key of the sidebar to use on the current page. See widgets.php::tcr_dynamic_sidebar()
tcr_pre_save_options array The theme options array before they are saved (admin side only). You must return the given $options from functions hooked to this.

Examples

The code should be added to wp-content/themes/react-child/functions.php

Remove the sidebar on all archive pages

1
2
3
4
5
6
7
8
9
function my_set_archive_layout($layout)
{
    if (is_archive()) {
        $layout = 'full-width';
    }
 
    return $layout;
}
add_filter('tcr_layout', 'my_set_archive_layout');
function my_set_archive_layout($layout)
{
    if (is_archive()) {
        $layout = 'full-width';
    }

    return $layout;
}
add_filter('tcr_layout', 'my_set_archive_layout');

Change the featured image type for a single post (post ID 15)

1
2
3
4
5
6
7
8
9
10
        
function my_set_post15_image_type($type)
{
    if (get_the_ID() == 15) {
       $type = 'left';
    }
 
    return $type;
}
add_filter('tcr_blog_featured_image_type', 'my_set_post15_image_type');
        
function my_set_post15_image_type($type)
{
    if (get_the_ID() == 15) {
       $type = 'left';
    }

    return $type;
}
add_filter('tcr_blog_featured_image_type', 'my_set_post15_image_type');

Still having trouble? Head over to the forums.

Forums