Saturday 8 October 2016

In WordPress if template name is "something" then excecute code?

Just add following code where you need.


<?php
if ( is_page_template('template_file_name.php') ) {
    // Returns true when 'template_file_name.php' is being used.
} else {
    // Returns false when 'template_file_name.php' is not being used.
}
?>


For more Interesting, Useful Article & codes visit IT New Code.

Ankit Shah PHP Expert

IT New Code suggest a solution for your problem related to coding, Specially .PHP, Wordpress, WooCommerce, Magento, HTML and CSS. Visit Our website for Information.

0 comments:

Post a Comment

 

Copyright @ 2016 IT New Code | Developing Code | Designing Code.

Designed by: Ankit Shah