php - Wordpress Get Template part -


going trough wordpress template found template

<?php              if ( is_home() ) {                 get_template_part('home', 'featured');                  get_template_part('home', 'recent');             }         ?> 

which calls template parts when home page displayed.

is there way use same function pages? example domain-name.com/contact ?

thanks

you can use is_page determine page. example:

if ( is_page('contact') ) {     get_template_part('home', 'featured');      get_template_part('home', 'recent'); } 

the parameter function can page id, page title or page slug.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -