• I have a plugin developed for me that is supposed to show the current post on the home page up to the More shortcode. It is displaying the whole post instead.

    Here’s the relevant code:

    add_shortcode( 'most-recent-post', 'show_most_recent_post' );
    function show_most_recent_post() {
    
    	$re_post = '';
    
    	if ( is_feed() )	return '[most-recent-post]';
    
    	//The Query
    	query_posts('posts_per_page=1');
    	//The Loop
    	if ( have_posts() ) : while ( have_posts() ) : the_post();
    		$re_post .= '<h2>' . the_title('', '', false) . '</h2><br />';
    		$content = get_the_content();
    		$content = apply_filters('the_content', $content);
    		$content = str_replace(']]>', ']]>', $content);
    		$re_post .= $content;

    I have checked the Function Reference and the code appears to be right but it doesn’t work. Can anyone see anything obvious?

    Thanks,
    Peter

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Display current post to on Home Page’ is closed to new replies.