WordPress.org

Support

Support » Themes and Templates » Best practice for using template tags

Best practice for using template tags

  • bothsidesnow
    Member

    @bothsidesnow

    I don’t want to run PHP inside posts.

    So the only solution when I need a template tag is to create a new template for it?! This seems awkward. It results in content being splattered around — some content in your template files, some in your DB.

    Example show below: using <?php bloginfo(‘admin_email’) ?>
    on contact page requires creating a whole new template,
    creating a page in DB, then assigning template to the page.

    If anyone can clue me to a less convoluted approach, I will be grateful. I am new here. Thank you.

    ===start example

    <?php
    /*
    Template Name: Contact
    */
    ?>

    <?php get_header(); ?>
    <h1><?php the_title(); ?></h1>
    <p>Please email us with any questions: <?php bloginfo(‘admin_email’) ?></p>

    <?php get_footer(); ?>

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Best practice for using template tags’ is closed to new replies.