Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Micah Wood

    (@woodent)

    @dazdorey,

    When displaying excerpts in the slider, the Promotion Slider plugin just displays the default WordPress excerpt. Any ellipses on the end, or ‘Continue reading…’ links, etc are added by the theme or possibly another plugin. WordPress provides a filter so that themes and plugins can manipulate this output.

    Adding something like this to your active theme’s functions.php file should do the trick:

    add_filter( 'excerpt_more', 'custom_promo_slider_excerpt_more' );
    function custom_promo_slider_excerpt_more( $more ) {
    	if( 'ps_promotion' == get_post_type() ) {
    		$more = '';
    	}
    	return $more;
    }

    Hi Micah,

    I couldn’t remove the ‘continue reading’ link using your code above in my functions.php file.

    My promotions go to internal pages on my website not to posts so the ‘continue reading’ text is not needed.

    I am using a child theme of twenty ten.

    Also, I would prefer to insert html for each slide using the post content box rather than the excerpt box in the admin for each slider.

    Please help.

    So far I am really impressed with this plugin! Great work!

    Plugin Author Micah Wood

    (@woodent)

    @adsleeblythe,

    The ‘excerpt_more’ filter is a built-in WordPress hook: https://codex.www.ads-software.com/Plugin_API/Filter_Reference/excerpt_more

    TwentyTen uses this filter to add the ‘continue reading’ link. Just add this to your functions.php file to disable it:

    remove_filter( 'excerpt_more', 'twentyten_auto_excerpt_more' );

    You could use the post content instead of the excerpt in the slide, however it would take some manipulating as that isn’t the way the plugin was intended to work.

    Thanks Micah,

    I done some reading and got it working using:

    <?php
    function really_remove_the_2010_excerpt_filter () {
    remove_filter( 'excerpt_length', 'twentyten_excerpt_length' );
    remove_filter( 'get_the_excerpt', 'twentyten_custom_excerpt_more' );
    remove_filter( 'excerpt_more', 'twentyten_auto_excerpt_more' );
    }
    add_action('after_setup_theme','really_remove_the_2010_excerpt_filter');
    ?>

    I obtained this from a previous WP thread from a person with a similar problem.

    However, am I correct in saying that the code above must remove the ‘Continue reading’ link from all excerpts on my site?

    How would I remove this filter from ONLY promotion slider posts?

    I don’t want this to affect other post types on my website.

    Thanks again!

    How would I implement the code above into the code you provided at the start of this thread?

    Thanks

    Plugin Author Micah Wood

    (@woodent)

    Try this:

    <?php
    function really_remove_the_2010_excerpt_filter () {
       $post = get_post();
        if( $post && 'ps_promotion' == $post->post_type ) {
           remove_filter( 'excerpt_length', 'twentyten_excerpt_length' );
           remove_filter( 'get_the_excerpt', 'twentyten_custom_excerpt_more' );
           remove_filter( 'excerpt_more', 'twentyten_auto_excerpt_more' );
        }
    }
    add_action('after_setup_theme','really_remove_the_2010_excerpt_filter');
    ?>

    That will check to make sure we are on the promotion post type before removing any links.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘remove Continue reading…’ is closed to new replies.