Featuring pages on another page / post than home

⚠️ Code snippets might not be compatible with the latest version of your theme. Always use a child theme to customize your theme, and test your code on a staging website before migrating to production.

Let’s say you’ve setup three beautiful featured pages on your home page. Now you might want to display this block of featured pages in another post or page of your website.

This snippet will show you how to do it.

 

Note : Customizr-Pro and Featured Pages Unlimited users should replace `__get_option` with `__get_fpc_option` and `tc_show_featured_pages` with `tc_show_fp`

Move your home featured pages in another page / post

In the following example, I move featured page from home to page with id #47.

 

add_filter ( 'tc_show_fp' , 'move_fp_from_home_to_somewhere');
function move_fp_from_home_to_somewhere () {
	//this checks if there are featured pages defined in the theme options in database and if your conditional tag returns a true value
	return 0 != esc_attr( tc__f( '__get_option' , 'tc_show_featured_pages' ) )
		&& is_page( 47 );
}

 

Duplicate your home featured pages in other pages/posts

In this example, I duplicate the featured pages to three different pages with ids #47, # 48, #49.

 

add_filter ( 'tc_show_fp' , 'my_fp_boolean_condition');
function my_fp_boolean_condition ($show_fp) {
	//this checks if there are featured pages defined in the theme options in database and if your conditional tag returns a true value
	return 0 != esc_attr( tc__f( '__get_option' , 'tc_show_featured_pages' )
		&& is_page( array (47, 48, 49 ) );
}

 

Useful resources :

38 thoughts on “Featuring pages on another page / post than home”

Comments are closed.