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.
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;?>
If you get only one post back the
<!--more-->
will be ignored, see the_excerpt() vs. the_content()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:In the context of this question:
should do it.
Answer from WordPress Support
functions.php
sidebar.php