• I added a custom page template to use as a page on my site.

    I basically just took out the get header and footer from the main page template.

    This is what I’m using as the custom page template:

    <?php
    /**
    Template Name: Opt In
    */
    
    ?>
    
    <!-- mid content --><div id="mid-content">  <?php if (have_posts()) : while (have_posts()) : the_post(); ?>    <div id="post-<?php the_ID(); ?>" <?php if (function_exists("post_class")) post_class(); else print 'class="post"'; ?>>        <p class="right edit-post"><?php edit_post_link(__('Edit','fusion')); ?></p>     <div class="clear"></div>     <div class="entry clearfix">      <?php the_content(__('Read the rest of this page &raquo;', 'fusion')); ?>      <?php wp_link_pages(array('before' => '<p class="postpages"><strong>'.__("Pages:","fusion").'</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>     </div>    </div>   <?php endwhile; endif; ?>   <?php comments_template(); ?></div><!-- mid content --></div><!-- /mid -->

    But it isn’t pulling in the meta data to get the page title & description.

    What do I need to add to the template code to get the meta data for this page?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Inside your while (have_posts()) : loop, you should be able to use the_title() and the_content to print the title and content, or prefix those two functions with get_ if you need to assign them to a variable.

    (You should be able to use the existing get_header function for a custom page template, to write the HTML <head> element with the page’s title, but that depends on your theme.)

    Hope some of this helps.

    Thread Starter RKCastillo

    (@rkcastillo)

    Would you mind writing out the code? I don’t really know php.

    I am using the wordpress seo plugin by Yoast for the meta title and description.

    So I want to just pull in that info for this page template.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Meta Data Into Custom Page Template?’ is closed to new replies.