Include Any File From Your Theme

<?php include (TEMPLATEPATH . '/your-file.php'); ?>

Comments

  1. User Avatar
    Guy Haines
    Permalink to comment#

    Thanks Dude.

  2. User Avatar
    stefan zimmermann
    Permalink to comment#

    awesome site for someone who hates learning to suck

  3. User Avatar
    Christopher Geary
    Permalink to comment#

    If your trying to include another file in (.php file) for your theme, then use get_template_part(), which looks like:

    <?php get\_template\_part( 'content' ); ?>

    It has an optional second paramater too which you can use to include something like: content-post.php by using:

    <?php get\_template\_part( 'content', 'post' ); ?>

    Read More:
    http://codex.wordpress.org/Function_Reference/get_template_part

    • User Avatar
      Christopher Geary
      Permalink to comment#

      You don’t need the backslashes, the “comment preview” didn’t like my underscores unless they had backslashes, and now its screwed up the actual comment.. -.-

Submit a Comment

Posting Code

You may write comments in Markdown. This makes code easy to post, as you can write inline code like `<div>this</div>` or multiline blocks of code in triple backtick fences (```) with double new lines before and after.

Code of Conduct

Absolutely anyone is welcome to submit a comment here. But not all comments will be posted. Think of it like writing a letter to the editor. All submitted comments will be read, but not all published. Published comments will be on-topic, helpful, and further the discussion or debate.

Want to tell us something privately?

Feel free to use our contact form. That's a great place to let us know about typos or anything off-topic.

icon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag