• Resolved IASR

    (@iasr)


    Hi Guys.

    Bit of a head-scratcher here.

    I want to have three pages, with category specific blog loops, an editable intro and page-specific sidebar content.

    I thought that adding a loop (pasted directly from loop.php) to a page template along with custom fields to handle the sidebar content would do the trick. But that is not the case.

    It seems that calling the custom field outside of <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?> results in nothing, but calling the loop from within that leads to the loop repeating infinitely.

    Ultimately I am looking for the best practice for creating a page of posts that allows for 2 page-specific editable text areas.

    Example pagehere.
    Using this page template.

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Are your custom fields on the Page that uses the ‘Workshop Page’ template? If so, get the values inside the top loop.

    So for example the Page could have a custom field named ‘category-to-show’ with the id of the category for that page.

    Thread Starter IASR

    (@iasr)

    Thanks for the reply.

    I worked out a less elegant but just as effective solution:

    Using `<?php
    $post_id = 175;
    $queried_post = get_post($post_id);
    $content = $queried_post->post_content;
    $content = apply_filters(‘the_content’, $content);
    $content = str_replace(‘]]>’, ‘]]>’, $content);
    echo $content;
    ?>`
    to print content from individual posts, I just injected them into the page template. Not the cleanest fix, but it works.

    The Page Template

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Page with custom fields and a loop of posts’ is closed to new replies.