• echo '<div class="entry-content">
    				<p><div class="entry-content"></div>';
    				$my_excerpt = get_the_excerpt('');
    				echo $my_excerpt;
    				echo '<div class="entry-terms">' , do_shortcode('[post_terms taxonomy="totd_tags" before="See Articles Related To " taxonomy="totd_tags"] '), '</div>' ;
    		echo '</p></div>

    I’m echoing the excerpt on a custom post type but need to remove the “Continue Reading” from the single post on those pages (because of course, that “Continue Reading” just links to the same post). The code above is what I’m using in the single-post-type.php.

    I need it to stay on the archives for that post type.

Viewing 7 replies - 1 through 7 (of 7 total)
  • I may be missing the point, but why are you using get_the_excerpt() on a single view? Wouldn’t you want all the content there, and not just the excerpt?

    Also, why two instances of a div with class entry-content?

    Thread Starter Angie Meeker

    (@ameeker)

    I had entry-content in as a quick place holder for a div I hadn’t created yet. It is fixed now.

    Here is the original site we’re converting to WP.
    Here’s the single post in this post type: http://www.manta.com/TOTD/operations/20140128/mphrqn0
    and the archive for it:
    http://www.manta.com/TOTD

    The excerpt is repeated at the top of each post.

    Here’s an example of the single post I have so far:
    http://m.angiemeekerdesigns.com/totd/marketing20140115/

    Thread Starter Angie Meeker

    (@ameeker)

    Thinking outloud.
    They are importing a ton of content. For THAT content the excerpt is in a .csv. I could import that into a custom field and echo that on the single post without using the excerpt. That would solve this issue for the imported posts.

    And that field would still be available for use going forward, but how could use that custom field as the excerpt in the archive instead of the automatically generated excerpt?

    Seems like that would solve this issue pretty neatly.

    Thread Starter Angie Meeker

    (@ameeker)

    Ok, poking around a bit.

    To make WP switch out my custom field for the excerpt

    add_action( 'save_post', 'my_custom_field_save' );
    function my_custom_field_save( $post_id )
    {
        if ( $_POST['post_type'] == 'post' ) {
            add_post_meta($post_id, 'custom_excerpt_field', get_the_excerpt($post_id), true);
        }
    }

    And to then display that:

    // Only output if we have tips data
    	if ($tips_data_pre['totd_tags'] != '' ||
    		$tips_data_pre['tip_article_headline'] != '' ||
    		$tips_data_pre['article_author'] != '' ||
    		$tips_data_pre['article_author_link'] != '') {
    
    		echo '<div class="tip-excerpt">
    				<p><div class="entry-content"></div>';
    				$custom_excerpt_field_data = get_post_meta(get_the_ID(), 'custom_excerpt_field', true);
    				echo $custom_excerpt_field_data;
    				echo '<div class="entry-terms">' , do_shortcode('[post_terms taxonomy="totd_tags" before="See Articles Related To " taxonomy="totd_tags"] '), '</div>' ;
    		echo '</p></div>

    Does that seem right?

    If that works that’s freaking magic.

    Thanks – adding context helps me understand a lot more what you’re trying to achieve 🙂

    I’d suggest still using the excerpt, as that makes sense (to me), given the context here. It really is like a manual excerpt of the article.

    Is it possible you’re using a plugin that is adding the “Continue reading –>”? The arrow is in a span with class “meta-nav”, which doesn’t appear anywhere in Genesis or the Genesis sample child theme, so I suspect a plugin (or something specific to your theme’s functions.php file) is filtering the excerpt and adding that.

    Thread Starter Angie Meeker

    (@ameeker)

    Yeah, WP All Import is involved in this… The “excerpt” is actually a field of text that we’re porting into the excerpt field for these posts (not a true excerpt, ie, first x characters or words of the post).

    I guess I didn’t explain that well enough above. They’re not actually using an excerpt from the post, but rather ALWAYS manually crafting an excerpt. SO the import they gave us – the “excerpt” is always one paragraph in it’s own column.

    Right, that makes sense, and to me is a reasonable way of doing things given the old website and what you’re trying to recreate. I’m just saying that “Continue Reading –>” text is getting added by something (probably filtering ‘get_the_excerpt’), so the trick is to figure out what’s filtering it. I’d deactivate all plugins and see if that removes it.

    Unless the importer plugin is adding it, which would be annoying and stupid. But if that’s the case, you should see that text in the manual excerpt field, and should be able to remove it there.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Remove "Continue Reading" from echoed get_the_excerpt’ is closed to new replies.