Support » Fixing WordPress » Templates and the editor!

  • Resolved CallMeAndy


    Its probably a simple answer – not standard or no! Or I have just missed the obvious, but is there a way to use a page template, such as a page of posts, but to precede the output of the listings with the contents of the main window in the page editor. It seems to be an eith or scenario. At the moment – maybe there is something I can add easily in the template code.

    So as for instance to put a dialogue of some kind above the list.

Viewing 3 replies - 1 through 3 (of 3 total)
  • vtxyzzy


    It is certainly possible, and not too difficult. Your template just needs to have multiple Loops.

    To start, study the Codex article on The Loop.

    For an example, look at this site. Everything down to ‘A NOTE FROM OUR CLUB:’ is in the Page. Everything below that is pulled in by the template.

    The first loop is modeled after Twenty Eleven:

    if (have_posts()) {
       while (have_posts()) {
          global $more; $more = 0;
          get_template_part('content', get_post_format());

    Further down in the template is a second loop for the President’s Message:

    <?php $temp_query = $wp_query;  // Save the original query
    $more = 0;
    if (!have_posts())
       echo "Sorry, no message today.<br /><br /><br />";
    while (have_posts()) : the_post();
       get_template_part('content', 'frontpage');

    That template only shows 1 post in the PresidentsMsg category, but it could just as easily have shown more. Note that there is no provision for paging here because only the one post is wanted.



    Oh I see – well I will check this out properly tomorrow – thanks so much. The upper construct is exactly the sort of thing I find in Suffusions custom template and the second more in tune with their list of posts, but either way I think I get the drift.

    Your a gentleman Josh.

    Thank you so much.




Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Templates and the editor!’ is closed to new replies.