php - Can I find out what template is being used by a child page in Wordpress? -


i'm displaying list of child page using code below. i'm trying achieve alter icon depending on template used child page in wordpress.

here's have far :

<div class="col s12">             <?php             $args = array(                 'parent'        => $post->id,                 'post_type'     => 'page',                 'post_status'   => 'publish',                 'sort_column'   => 'menu_order',                 'order'         => 'asc'             );             $pages = get_pages($args);  ?>              <ul class="collection" id="page-links">                 <?php foreach( $pages $page ) { ?>                 <a href="<?php echo get_page_link( $page->id ); ?>">                     <li class="collection-item waves-effect waves-light" id="page-children"><?php echo $page->post_title; ?>                         <span class="secondary-content">                             <?php **if template 'page-url.php'** : ?>                                 <i class="fa fa fa-external-link"></i>                             <?php else :?>                                 <i class="fa fa fa-chevron-right"></i>                             <?php endif; ?>                         </span>                     </li>                 </a>                 <?php } ?>             </ul>         </div> 

i know can determine current template used page using

<?php if(basename(get_page_template()) === 'page-url.php') : ?> 

but can't seem find way find out template child page (without being on page itself).

you can use get_page_template_slug( $post_id ) , using child page id $post_id.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -