Template files

  • deputy963


    I’m trying to accomplish something that is way above my head and involves php and the database. Chances are I don’t have the knowledge to do it, but I’m trying.

    The simplest thing is to create a custom page template so I can insert php code into a page. I’ve tried several ways, but I can’t seem to place the php in the correct location to actually display withing the content area. I can get it above. I can get it below.


    * The Template for displaying all single pages.
    get_header(); ?>
    /* Run the loop to output the pages.
    * If you want to overload this in a child theme then include a file
    * called loop-page.php and that will be used instead.
    get_template_part( 'loop', 'page' );
    <?php get_footer(); ?>



    I’ve created a child theme and I’m still not having any luck. I get that the “loop” and “Page” format the page because I can remove them and get an echo to display, but I’m still at a loss.

    Any help is appreciated!



    Put your code before or after this:

    <?php the_content(); ?>

    Kenneth John Odle

    The simplest thing is to create a custom page template so I can insert php code into a page

    This is only an assumption. There may be easier ways.

    If you want to insert PHP on every page or every post, you can use one Graphene’s many built-in action hook widget areas:


    If you want to insert it only in a single page or post or only some of them, try this plugin:



    Kenneth John Odle





    Thanks for the info.

    I was hoping to create a template so that I could reuse and/or change the same code on multiple pages, but I can’t seem to figure out how to create my own template. Everything I could find on Google is different from Graphene – there is no mention of get_template, which is what prompted my question.

    Could you explain what the ‘loop’ and ‘page’ parts of get_template do? I’m guessing that loop pulls the WP loop and page pulls the content.

    ronangelo: There is no get_content in any of the templates.

    In the end I imagine it will be simpler to just use the insert php plugin, but it just seems unnecessary.

Viewing 6 posts - 1 through 6 (of 6 total)

  • You must be logged in to reply to this topic.
Graphene Themes Forum