WordPress.org

Plugin Directory

Changeset 1569841 for add-to-any


Ignore:
Timestamp:
01/06/2017 10:58:49 PM (18 months ago)
Author:
micropat
Message:

Fix custom/secondary contexts check when the WP query object is unavailable

Location:
add-to-any/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • add-to-any/trunk/README.txt

    r1569341 r1569841  
    44Requires at least: 3.7
    55Tested up to: 4.7
    6 Stable tag: 1.7.3
     6Stable tag: 1.7.4
    77
    88Share buttons for WordPress including the AddToAny sharing button, Facebook, Twitter, Google+, Pinterest, WhatsApp, many more, and follow icons too.
     
    335335== Changelog ==
    336336
     337= 1.7.4 =
     338* Fix custom/secondary contexts check when the WP query object is unavailable
     339
    337340= 1.7.3 =
    338341* Add icon size options for the floating share buttons
    339342* Replace packaged PNG icons with SVG icons
    340 * Update settings panel
     343* Update services in AddToAny settings
    341344* Update standard placement to prevent the share buttons from automatically appearing in custom/secondary contexts
    342345* Set feed URL & title in AddToAny Follow widgets using HTML5 data attributes
  • add-to-any/trunk/add-to-any.php

    r1569341 r1569841  
    44Plugin URI: https://www.addtoany.com/
    55Description: Share buttons for your pages including AddToAny's universal sharing button, Facebook, Twitter, Google+, Pinterest, WhatsApp and many more.
    6 Version: 1.7.3
     6Version: 1.7.4
    77Author: AddToAny
    88Author URI: https://www.addtoany.com/
     
    768768    global $wp_current_filter;
    769769   
    770     // Bail if not main query
    771     if ( ! is_main_query() && ! in_the_loop() ) {
     770    // Bail if not in the loop
     771    if ( ! in_the_loop() ) {
    772772        // Return early
    773773        return $content;
     
    875875}
    876876
    877 add_filter( 'the_content', 'A2A_SHARE_SAVE_add_to_content', 98 );
    878 add_filter( 'the_excerpt', 'A2A_SHARE_SAVE_add_to_content', 98 );
     877
     878function A2A_SHARE_SAVE_pre_get_posts( $query ) {
     879    if ( $query->is_main_query() ) {
     880        add_filter( 'the_content', 'A2A_SHARE_SAVE_add_to_content', 98 );
     881        add_filter( 'the_excerpt', 'A2A_SHARE_SAVE_add_to_content', 98 );   
     882    }
     883}
     884
     885add_action( 'pre_get_posts', 'A2A_SHARE_SAVE_pre_get_posts' );
    879886
    880887
Note: See TracChangeset for help on using the changeset viewer.