WordPress.org

Ready to get started?Download WordPress

Forums

Jetpack by WordPress.com
Sharedaddy fails after apply_filters('the_content'..) (4 posts)

  1. manuelmasia
    Member
    Posted 1 year ago #

    Hi,

    I created some shortcodes: tabs, accordions, slideshow, pricing tables. They are quite elaborated and can contain text: paragraphs, other shortcodes, videos etc. I use an additional tinyMCE editor to add content to the slides, the tab panel etc.

    To print the content of the shortcode I have to pass it though:

    $the_content = apply_filters('the_content', $the_content);

    So I'm sure all the default filters (wp_autop, do_shortcode etc.) and the filters due to the themes or other plugins will be applied to the output.

    Unfortunately, I guess because of these lines on Sharedaddy module:

    // Don't allow flair to be added to the_content more than once (prevent infinite loops)
    	$done = false;
    	foreach ( $wp_current_filter as $filter ) {
    		if ( 'the_content' == $filter ) {
    			if ( $done )
    				return $text;
    			else
    				$done = true;
    		}
    	}

    each time a shortcode has used in a post, Sharedaddy doesn't display the sharing icons at the end of the post itself... is there a workaround to this or simply Sharedaddy is not compatible with apply_filters('the_content'....

    TIA, Manuel :-)

    https://wordpress.org/plugins/jetpack/

  2. manuelmasia
    Member
    Posted 1 year ago #

    Ok, at this moment I've used this workaround (it is an example, I work with a class etc.): http://pastebin.com/HCfBYcHM

    But I don't think it's the best way... any tip is welcome. Thanks

  3. George Stephanis
    Automattic Lead Code Monkey
    Plugin Author

    Posted 1 year ago #

    Out of curiosity, why are you firing it multiple times? Are you firing the_content filter inside of a filter on the_content? I'm not quite sure what you're trying to accomplish here.

  4. manuelmasia
    Member
    Posted 1 year ago #

    I apply the filters of the content to the value of a metabox: the shortcodes are saved as meta boxes, I simply pass the shortcode in this way [shortcode tabs="2"]. This print the raw content of the metaboxes, so I use the filters. :-)

    Do you think is a wrong approach? It is useful to crete complicated slides, or table prices etc.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.