• I use custom excerpts, which currently don’t have the “continue reading->” link displayed.

    I installed the Q&A plugin, and used the shortcode on my home page – worked fine there. But it also makes the “continue reading” link reappear on all the excerpts, which I don’t want. When I disable the plugin, all the excerpts revert back to normal.

    Any ideas?

    https://www.ads-software.com/extend/plugins/q-and-a/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi Sanjoyroy-

    I had this same issue. The plugin developer is using a series of functions adapted from Twenty Eleven to modify the_excerpt() read-more links. The functions start at line 172 in /wp-content/plugins/q-and-a/inc/functions.php. If you want to disable them, add these lines to your theme’s functions.php file:

    remove_filter( 'excerpt_more', 'qaplus_auto_excerpt_more' );
    remove_filter( 'get_the_excerpt', 'qaplus_custom_excerpt_more' );
    remove_filter( 'excerpt_length', 'qaplus_excerpt_length' );

    Removing filters can be tricky, sometimes. Read more here: https://codex.www.ads-software.com/Function_Reference/remove_filter

    Developer: You can target these functions to only affect the qa_faqs post type:

    /**
     * Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and twentyeleven_continue_reading_link().
     */
    
    function qaplus_auto_excerpt_more( $more ) {
    	$post_type = get_post_type();
    
    	if ( $post_type == 'qa_faqs' ) {
    		return ' …' . qaplus_continue_reading_link();
    	}
    }
    add_filter( 'excerpt_more', 'qaplus_auto_excerpt_more' );
    /**
     * Adds a pretty "Continue Reading" link to custom post excerpts.
     *
     */
    
    function qaplus_custom_excerpt_more( $output ) {
    	$post_type = get_post_type();
    
    	if ( has_excerpt() && ! is_attachment() && $post_type == 'qa_faqs' ) {
    		$output .= qaplus_continue_reading_link();
    	}
    	return $output;
    }
    add_filter( 'get_the_excerpt', 'qaplus_custom_excerpt_more' );

    -David

    Thread Starter sanjoyroy

    (@sanjoyroy)

    Thanks David – you figured it out!

    In fact, I already changed my plugin to FAQ Manager, which works fine for what I need to do, so I don’t have to worry about the filters (thankfully – you say that it can be tricky, and to me it *looks* tricky!).

    I hope the developer takes note of your code though.

    Hi all

    Just to add one more side effect:
    after hours struggling and trying to find why for god sake the “Continue reading–>” string did not get translated i′ve finally found it around line 188 of “functions.php”

    function qaplus_continue_reading_link() {
    	return ' <a href="'. esc_url( get_permalink() ) . '">' . __( 'Saiba Mais <span class="meta-nav">&rarr;</span>', 'qa-free' ) . '</a>';

    it seems that the plugin overrides all possible translations even if you are using a custom theme.

    Also the plugin′s language files are overrided by functions.php

    i hope it helps someone else

    Thank you David! Adding the mentioned “remove filter” code to the theme’s functions.php fixed the issue for me. ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Plugin conflict with custom excerpt "continue reading" link’ is closed to new replies.