• Resolved Lisa

    (@candeeg)


    Love this plugin – I made a custom “Escape” button that goes to a google news page. I need it to open in the same window as the site, in effect, escaping the site. Can someone help me with the code?

    Here’s what i put in the functions.php file – and it works nicely. i’m not strong in php tho’. Can’t get the target to work.
    THANKS for any help!

    function addtoany_add_services( $services ) {
    $services[‘example_share_service’] = array(
    ‘name’ => ‘Escape Button’,
    ‘icon_url’ => ‘http://care.cejay.net/wp-content/uploads/escapebtn.png’,
    ‘icon_width’ => 32,
    ‘icon_height’ => 86,
    ‘href’ => ‘https://news.google.com/nwshp?hl=en&tab=wn’ . ‘target=/”_top/”‘
    );
    return $services;
    }
    add_filter( ‘A2A_SHARE_SAVE_services’, ‘addtoany_add_services’, 10, 1 );

    https://wordpress.org/plugins/add-to-any/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author micropat

    (@micropat)

    Right now the target="_blank" attribute is hardcoded in the plugin, so the next best approach would be to overwrite that element’s target attribute using JavaScript.

    Example JavaScript for your “Additional Options” box in AddToAny settings:

    a2a_config.callbacks.push({
        ready: function() {
            jQuery('a[title="Escape Button"]').attr('target', '_top');
        }
    });

    This waits for the AddToAny “ready” event.

    Thread Starter Lisa

    (@candeeg)

    Lovely – this did just what i needed it to do. Thank you very much! C

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom icon to open in same window’ is closed to new replies.