Best practice for using template tags (3 posts)

  1. bothsidesnow
    Posted 7 years ago #

    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

    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(); ?>

  2. MichaelH
    Posted 7 years ago #

    Typically you would change and existing template file or add a new template as you suggested.

    For contact forms, a plugin might be preferable though.

  3. bothsidesnow
    Posted 7 years ago #

    Thanks for your reply, MichaelH.

Topic Closed

This topic has been closed to new replies.

About this Topic