Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Cliff Seal

    (@cliffseal)

    Divi does a lot of crazy stuff, but I’ll see if I can make this attach a bit more cleanly in a new version. Hopefully that’ll help.

    Plugin Author Cliff Seal

    (@cliffseal)

    You might be able to fix this by conditionally filtering things using the hooks I’ve provided. This is untested:

    add_action( 'the_content', 'yournamespace_exclude_infographic' );
    
    function yournamespace_exclude_infographic() {
    
        // See if category archive is being diplayed
        if ( is_category() ) {
    
            add_filter( 'infographic_embedder_image_code', 'yournamespace_return_empty_string' );
            add_filter( 'infographic_embedder_download_html', 'yournamespace_return_empty_string' );
            add_filter( 'infographic_embedder_embed_html', 'yournamespace_return_empty_string' );
    
        }
    
    }
    
    function yournamespace_return_empty_string() {
    
        return '';
    
    }
    Thread Starter xdundee

    (@xdundee)

    Hi, this hid all the pages so just header and footer remained.
    Any other ideas?

    Plugin Author Cliff Seal

    (@cliffseal)

    Derp. Gave you the wrong action to hook into. Let’s try this instead.

    add_action( 'the_post', 'yournamespace_exclude_infographic' );
    
    function yournamespace_exclude_infographic() {
    
        // See if category archive is being diplayed
        if ( is_category() ) {
    
            add_filter( 'infographic_embedder_image_code', 'yournamespace_return_empty_string' );
            add_filter( 'infographic_embedder_download_html', 'yournamespace_return_empty_string' );
            add_filter( 'infographic_embedder_embed_html', 'yournamespace_return_empty_string' );
    
        }
    
    }
    
    function yournamespace_return_empty_string() {
    
        return '';
    
    }
    Thread Starter xdundee

    (@xdundee)

    99% there.
    Now there is just “%px” inserted to the end of the excerpt. I found out you can also fix it by simply setting your own custom excerpt in post editing.

    Plugin Author Cliff Seal

    (@cliffseal)

    Well dang, that’s the one unfilterable part of the content output. Maybe this’ll fix you up enough:

    add_filter( 'get_the_excerpt', 'yournamespace_exclude_infographic_percentage' );
    add_filter( 'the_content', 'yournamespace_exclude_infographic_percentage' );
    
    function yournamespace_exclude_infographic_percentage($output) {
    
        // See if category archive is being diplayed
        if ( is_category() ) {
    
            $output = str_replace( '%px', '', $output );
    
        }
    
        return $output;
    
    }

    Yeah, custom excerpts will definitely fix it in any case, but I’d prefer for you to not have to do that. 🙂

    Thread Starter xdundee

    (@xdundee)

    Thanks. Unfortunately take that cool functionality to Download infographic also from the grid view where it works. But I understand it might be hard, there must be some reason why Divi blog grid works but Divi blog fullwidth doesn’t.
    Anyway take it as problem solved. Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Plugin adds code to post excerp’ is closed to new replies.