WordPress ignores excerpt

Using the below I am able to populate a list and the text from my posts into my Sidebar in WordPress.

I have placed the <!--more--> tag into my post but it seems to get ignored using the below script.

Read More

Could someone assist please

PHP in WordPress

<?php $the_query = new WP_Query( 'showposts=2' ); ?>
    <?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>
    <li>
        <a href="<?php the_permalink() ?>"><?php the_title(); ?></a>
        <p><?php the_content('<span class="readmore strong">'.__('Read more').'</span>'); ?></p>
    </li>
    <?php endwhile;?>

Related posts

Leave a Reply

2 comments

  1. If you get only one post back the <!--more--> will be ignored, see the_excerpt() vs. the_content()

    Sometimes, it is more meaningful to use only the the_content()
    function which will decide what to display according to whether the
    <!--more--> quicktag was used. The <!--more--> quicktag splits a post
    into two parts; only the content before the tag should be displayed in
    listing. Remember that <!--more--> is (of course) ignored when showing
    a single post.

    Just try to use <?php the_excerpt(); ?>.

    Update:
    Like I said in the comments and Donald got helped from the WordPress Support, the solution seems to be to override the global $more like WordPress Reference:

    <?php global $more; $more = 0; ?>
    

    In the context of this question:

    <?php $the_query = new WP_Query( 'showposts=2' ); ?>
        <?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>
        <?php global $more; $more = 0; ?>
        <li>
            <a href="<?php the_permalink() ?>"><?php the_title(); ?></a>
            <p><?php the_content('<span class="readmore strong">'.__('Read more').'</span>'); ?></p>
        </li>
        <?php endwhile;?>
    

    should do it.