WordPress.org

Forums

Jetpack by WordPress.com
Jetpack & WooCommerce puts Sharing buttons above content (5 posts)

  1. Robert Dall
    Member
    Posted 1 year ago #

    Any reason why Jetpack sharing is going above the products on the category product pages? http://store.northernphoto.ca/product-category/books/

    When I look at the code I it looks like they are actually being injected into the

    <div class="term-description"></div>

    Which is kinda an odd place for sharing button don't ya thing?

    Here is a Gist for the source code of the entire section tag.

    https://gist.github.com/robertdall/6ea69710c0fb388b6433

    But also you can view the dev site here: http://store.northernphoto.ca/shop/

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

  2. Robert Dall
    Member
    Posted 1 year ago #

    I added some text to the description of the category just to see if it was going to be put into the same div.

    And Yes the text I put in my Category Description is in the same div that Jetpack is putting it's sharing button.

    All of this is being hooked in automatically by a WooCommerce Category and then JetPacks Sharing which should hooking in after the content.

  3. Jeremy Herve
    Happiness Engineer
    Plugin Author

    Posted 1 year ago #

    While I'm not familiar with Woocommerce, it's possible that they've added the_content() inside their .term-description div to allow shop owners to easily add a description for each product.

    Since Jetpack's sharing module hooks into the_content and the_excerpt, it gets added everywhere where the tags are used.

    You should be able to move the sharing buttons to a different location thanks to that tutorial:
    http://www.jefffoxx.com/2013/03/add-social-sharing-to-your-woocommerce-product-page-with-jetpack/

    Another alternative would be to find the conditional tag returning true on category product pages (it seems to be is_product_category() according to the documentation), and remove the sharing buttons only on these pages, like so:

    function jptweak_remove_share() {
        if ( is_product_category() ) {
            remove_filter( 'the_content', 'sharing_display',19 );
            remove_filter( 'the_excerpt', 'sharing_display',19 );
            if ( class_exists( 'Jetpack_Likes' ) ) {
                remove_filter( 'the_content', array( Jetpack_Likes::init(), 'post_likes' ), 30, 1 );
            }
        }
    }
    add_action( 'loop_start', 'jptweak_remove_share' );

    You can find out more about Jetpack's sharing buttons and how to customize them here:
    http://jetpack.me/2013/06/10/moving-sharing-icons/

    Let me know if it helps.

  4. Robert Dall
    Member
    Posted 1 year ago #

    So this would be more a WooCommerce bug then anything to do with Jetpack?

    I try to fix it on my own site. But I'd also like to report the bug as well…

  5. Jeremy Herve
    Happiness Engineer
    Plugin Author

    Posted 1 year ago #

    I'm not sure that's a bug. I can imagine that some people might want to add sharing buttons or other things there. That's also not specific to Jetpack: If you were to use another sharing plugin or any plugin hooking into the_content(), the same thing would happen on your category product pages.

    Woocommerce seems to use the_content() intentionally:
    https://plugins.trac.wordpress.org/browser/woocommerce/tags/2.1.7/includes/wc-template-functions.php#L490

    You could get in touch with the plugin developers if you think that should be removed from the category product pages.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Jetpack by WordPress.com
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic