WordPress.org

Ready to get started?Download WordPress

Forums

How to get the template LABEL from a page? (2 posts)

  1. totanus
    Member
    Posted 6 years ago #

    Is there a way to know which kind of template page I'm using on a given page?

    For example: I could have two kind of templates, "two-cols" and "three-cols" and this page tree:

    Home
    - Info (using "two-cols" template)
    - Links(using "two-cols" template)
    - Contact(using "three-cols" template)

    How can I get the ID of the template for Info page?
    Thank you for any hints!

    Matteo

  2. MichaelH
    Member
    Posted 6 years ago #

    Found this in wp-includes/theme.php

    $template = get_post_meta($id, '_wp_page_template', true);

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags