• Resolved stormrider

    (@stormrider)


    I just upgraded to 2.5, and on some external pages where I pull post text from WP, the_content is showing the entire content and not stopping where the ‘more’ tag is placed.

    Here is the loop:

    <?php
     $my_query = new WP_Query('category_name=howto&showposts=2');
     while ($my_query->have_posts()) : $my_query->the_post();
      $do_not_duplicate = $post->ID; ?>
      <a>"><?php the_title(); ?></a>:<?php the_content(); ?>
     <?php endwhile; ?>

    Within WordPress the_content is working as it is supposed to, and showing the more link.

    Is there some change to the 2.5 code that would make it behave like this?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter stormrider

    (@stormrider)

    bump, I’m still hitting my head against the wall here.

    Thread Starter stormrider

    (@stormrider)

    bump again

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    You are correct, the more tag does not work on custom queries like that.

    You can set the global $more variable to either 1 or 0 to turn the more functionality on or off. Do this right before your call to the content:

    global $more;
    $more = 1;

    Thread Starter stormrider

    (@stormrider)

    Thanks for the response.

    So my code now reads:

    <?php $my_query = new WP_Query('category_name=howto&showposts=2');
            while ($my_query->have_posts()) : $my_query->the_post();
            $do_not_duplicate = $post->ID; ?>
            <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>:
    		<?php global $more;
    		$more = 1;
    		the_content(); ?>
            <?php endwhile; ?>

    This still doesn’t work though. Was changed in 2.5?, because it worked before.

    Edit: Got it. 0 turns more on, 1 turns more off.
    So:

    <?php global $more;
    		$more = 1;

    Fixed it.

    Thank you.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    Try $more = 0 then. I’m not sure what 1 and 0 mean in that context.

    I’m having a similar problem with my rss feed in 2.5 (for https://conal.net/blog). The <!--more--> tag is having no effect in in the feed. Is this a known issue, and is there a solution? I am using feedburner, and I don’t know for sure whether my feed/more problem began before or after switching to feedburner.

    Thanks, – Conal

    Hi,

    I am having problem with the <!–more–> tag since my wordpress is upgraded to 2.5.

    On the homepage, it works fine but when it comes to category page, it’s not working.

    From earlier post where can I find this tag? I want to give a try. hope to hear from you. Thanks.

    ——————-
    <?php $my_query = new WP_Query(‘category_name=howto&showposts=2’);
    while ($my_query->have_posts()) : $my_query->the_post();
    $do_not_duplicate = $post->ID; ?>
    “><?php the_title(); ?>:
    <?php global $more;
    $more = 1;
    the_content(); ?>
    <?php endwhile; ?>
    ———————

    I keep finding this solution to make more = 0 before the content call… but it doesn’t work on a page that is not the home page (I have a static page for the home page).

    Any ideas, please?

    relish, I think I had the same problem as you. I use a static front page and have an empty Blog page to make the blog a standard page link. This worked for me:

    <?php global $more; $more = 0; the_content(‘[Read more…]’); ?>

    Note I also needed a call to query_posts above the loop to find the posts.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘the_content not responding to the “more tag” outside of WP’ is closed to new replies.