I am creating different pages, using templates.

For example: page-blog.php. For certain group of pages, I would like to include a local navigation.

If I use page.php I am able to include the local nav by checking the id:

  if(is_page(array(18,52,22,20))) {
   // code

But once I use a template for the page this does not work anymore. Where I need to check the id, so I can display local nav?

It is not convenient to do it in the templates because the website has too many pages.


You can also check if you are on page template with is_page_template function:

  if(is_page(array(18,52,22,20)) || is_page_template( 'blog.php' )) {
       //do your stuff
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.