php - Checking for page templates in child theme -


i have simple problem i'm hoping can shed light on. have child theme custom page template , i'm trying check weather or not template in use. under normal circumstances, have used is_page_template function, doesn't seem working child themes. i've tried following

if(is_page_template('template-custom-fullwidth.php')){     //do something.. } 

as

if(is_page_template(dirname(get_bloginfo('stylesheet_url')).'/template-custom-fullwidth.php'){     //do something.. } 

neiter works , hoping there more elegant solution using $_server check urls. can't imagine there not being function seeing seems common task. believe problem difference between template , stylesheet directories. possible use wordpress check page templates located in child theme?

thanks in advance!

reference wp codex page: http://codex.wordpress.org/function_reference/get_stylesheet_directory_uri

use get_stylesheet_directory_uri instead. should work:

is_page_template(get_stylesheet_directory_uri() . '/template-custom-fullwidth.php') {     //do something.. } 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -