Saturday 15 March 2014

Conditional stament for custom template page in WordPress -


What is the conditional statement for a specific custom template page in WordPress?

Example:

  & lt ;? Php if (page ('custom-home.php')) {? & Gt; // it's on my home page & lt ;? Php} elseif ('custom-gallery.php')) {? & Gt; // Do this on your Gallery page & lt ;? Php} and {? & Gt; & Lt ;? Php}? & Gt;    

Returns when the correct template is being used:

  if (is_page_template ('custom-home.php')) {// do home stuff} elseif (is_page_template ('custom-gallery.php')) {// Gallery stuff}    

No comments:

Post a Comment