• Resolved bcreighton

    (@bcreighton)


    Hi,

    My more link isn’t behaving properly in the sidebar when on a Page. Posts work perfectly. I’m using query_posts to pull in a bit of content and the more link is rendering as an empty span where it should be. It also doesn’t truncate it at the more link and shows the full text.

    Why would Pages behave differently than Posts? I’m also using a custom Page template if that should make a difference…

    Thanks.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter bcreighton

    (@bcreighton)

    The code for the sidebar content looks like this:

    <?php query_posts('cat=6&showposts=1 ');	?>
            <?php if (have_posts()) : ?>
            <?php while (have_posts()) : the_post(); ?>
            <div class="journal-body" id="post-<?php the_ID(); ?>">
              <h4>
                <?php the_title(); ?>
              </h4>
              <?php the_content('Read more &raquo;');?>
            </div>
            <?php endwhile; ?>
            <?php else : ?>
            <p>Not Found</p>
            <?php endif; ?>

    The “more” never worked and doesn’t work on Pages. Since there is no “multi-Page” view in WP (as opposed to multi-post view) – no need for it.

    Thread Starter bcreighton

    (@bcreighton)

    But isn’t page content, it’s post content that I’m pulling in the sidebar. The sidebar just happens to be included on the page…

    Thread Starter bcreighton

    (@bcreighton)

    Ah, but thank you for linking to the page post. I figured it out, you just need to add:

    global $more;
    $more = 0;

    before the loop.

    If you’re using the <!– more –> quicktag to place things below the fold in your posts, you’ll want to include the global variable $more and set it to zero (as shown in the code above). Otherwise, the entire post will print out on your blog’s main page.

    The sidebar just happens to be included on the page…
    That’s enough! WP “knows” it is on a Page… otherwise all those
    if is_page...
    conditionals would never work.

    Thread Starter bcreighton

    (@bcreighton)

    Gotcha. At least WP provides a work-around for people pulling in post content on pages…

    Thanks.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Sidebar Content Issue only for Pages’ is closed to new replies.