WordPress.org

Ready to get started?Download WordPress

Forums

Pinterest "Pin It" Button
[resolved] use post content in pinit shortcode description field (4 posts)

  1. Gabe462
    Member
    Posted 1 year ago #

    Hello, I'm trying to figure out what it will take to get this working. I want to pin the post content, so I'm using the shortcode form and trying to stick get_the_content() into the description="" field.

    Unfortunately I'm still getting the post title as the pin content, and the post content is appearing below the pinit button. Any ideas?

    function add_pinterest_via_shortcode( $content ) {
    	$pin_content = strip_tags( get_the_content() );
    	$content .=  do_shortcode("[pinit description=' $pin_content']");
    
    	return $content;
    }
    add_filter( 'the_content', 'add_pinterest_via_shortcode');

    http://wordpress.org/extend/plugins/pinterest-pin-it-button/

  2. Gabe462
    Member
    Posted 1 year ago #

    I realized that trying to use a description that contains quotes, escaped or not, reverts the plugin back to using the title. Any idea why?

  3. Gabe462
    Member
    Posted 1 year ago #

  4. Phil Derksen
    Member
    Plugin Author

    Posted 1 year ago #

    Glad you found it!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic