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.

HookDate typeDescription
tcr_status_avatar_sizeintegerDefault 65. The number passed to get_avatar in the Status post format template content-status.php
tcr_image_sizesarrayThe 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_postobjectDefault is the value returned by get_queried_object().
tcr_stylesarrayThe 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_scriptsarrayThe 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_sizesarrayThe array of favicon sizes to automatically generate. The default is:

array(57,72,76,114,120,144,152,180)
tcr_page_layoutstringDefault ‘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_typestringDefault ‘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_optionsarrayThe configuration array for the full screen lightbox script “Serene”. See this page for options.
tcr_background_image_urlstringThe URL of the background image to display, loops through each of them before they are passed to the full screen background script.
tcr_background_optionsarrayThe configuration array for the full screen background script. See this page for options.
tcr_head_contact_quform_idintegerThe form ID of the first Quform popup form in the header.
tcr_head_contact_quform_id_salesintegerThe form ID of the sales Quform popup form in the header.
tcr_head_contact_quform_id_supportintegerThe form ID of the support Quform popup form in the header.
tcr_logo_link_urlstringThe URL that the logo should link to.
tcr_contact_quform_id_infomenuintegerThe form ID of the Quform form to use in the Contact Info Menu item.
tcr_footer_end_page_popoutstringThe text/HTML to display in the small pop-out box when the user scrolls to the footer of the page.
tcr_intro_titlestringThe title text/HTML in the intro section.
tcr_intro_subtitlestringThe subtitle text/HTML in the intro section.
tcr_show_introbooleanWhether or not to display the intro section.
tcr_show_intro_devicesarrayThe array of which devices to show the intro on. See the array layout in theme.php::tcr_intro()
tcr_introstringThe HTML of the intro section; shortcodes are parsed inside it
tcr_layoutstringThe page layout, one of: ‘left-sidebar’, ‘full-width’, ‘right-sidebar’
tcr_videoarrayThe configuration array for background videos videos. See the array layout in theme.php::tcr_set_video_background().
tcr_video_vimeoarrayThe configuration array for Vimeo background videos. See the array layout in theme.php::tcr_set_video_background().
tcr_video_youtubearrayThe configuration array for YouTube background videos. See the array layout in theme.php::tcr_set_video_background().
tcr_audioarrayThe 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
stringThe 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
booleanEnables or disables the featured image for these posts types in the blog page, archives and search results.
tcr_post_iconstringSets the FontAwesome icon to use for the current Post. See theme.php::tcr_post_icon()
tcr_video_infoarrayGet the video type and ID from a YouTube / Vimeo URL. See theme.php::tcr_get_video_info()
tcr_get_sidebarsarrayGet the array of theme sidebars. See widgets.php::tcr_get_sidebars()
tcr_sidebarstringThe key of the sidebar to use on the current page. See widgets.php::tcr_dynamic_sidebar()
tcr_pre_save_optionsarrayThe 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