WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Add to Any: Share/Bookmark/Email Button] sharesave shortcode doesnt work to place button in (6 posts)

  1. windows2000
    Member
    Posted 4 years ago #

    In the AddtoAny docs, it suggests you can use a comment shortcode:

    <!--sharesave-->

    However, this simply doesnt function. I checked the add-to-any.php code and there doesn't appear to be any code that would cause this to function? (There is a section to disable the button if nosharesave is used.)

    I really would like to use AddtoAny by putting strategically placed Share buttons both at the Top and Bottom of my posts, but I need finer control than an automatic placement.

    Any ideas? The plugin looks good otherwise - I particularly appreciate that it doesn't cause the clients to load jQuery, keeping my visitors' pageloads fast.

  2. micropat
    Member
    Posted 4 years ago #

    See How can I move both the button and the individual icons to another area of my theme?. You'll probably want to place the suggested code in at least your theme's single.php file. From there you'll have much finer control. :)

  3. windows2000
    Member
    Posted 4 years ago #

    The problem is, I want to selectively add AddtoAny buttons in certain posts in certain locations mid-post-content.

    The PHP code won't help me because that is for placing the button consistently in the same location on every page, the opposite of what I need.

    Not to mention you can't insert PHP to the middle of a wordpress post (inside a HTML Table for instance).

    Is there a way to get the <!--sharesave--> to work properly? The <!--nosharesave--> does in fact work.

  4. micropat
    Member
    Posted 4 years ago #

    So what you're seeking for the plugin is a feature request, but it might be best to use AddToAny's generic code instead of the WordPress plugin.

    Right now <!--nosharesave--> just omits the default button from the bottom of posts, and <!--sharesave--> includes the button (if the button is not set to be automatically included at the bottom of posts).

    I think the best solution is to generate the button code when you need it and place that in your posts as desired.

    One caveat is that this won't work elegantly if you're using the plugin (due to the plugin's special load optimizations). If you wish to also place the buttons persistently in your template, also use the generic code in your theme's template files.

  5. windows2000
    Member
    Posted 4 years ago #

    Ah, now I understand. For some reason, I was under the impression that the <!--sharesave--> would insert the button wherever that tag was inserted. I now understand that is not the case - it is simply a toggle to enable the standard bottom-of-the-page button to show, regardless of where the sharesave tag itself is inserted.

    I wanted to avoid using the website button code because of its reference to off-site Javascript and images. I believe I can improve my visitors' pageload performance by hosting as much code/images on my site as possible, and minimizing 3rd party domain references.

    I guess I will have to use a hand edited combination of the button code and local copies of the stuff. This is the type of thing I hoped to avoid by using the plugin in the first place. But I still appreciate your helpful responses here!

  6. micropat
    Member
    Posted 4 years ago #

    No problem, glad I was able to clarify. :)

    Both the generic code and the plugin use AddToAny's hosted script. Used widely for over 3 1/2 years (billions of times a month), performance has always been top-notch and a priority. The static content is served from a fast and reliable CDN with efficient use of expires headers & compression.

    If performance is of upmost importance or policy dictates, and you have shell access and are able to set a cron job, you can fully cache the AddToAny script and images on your server(s). Feel free to check out the code caching program: http://www.addtoany.com/buttons/host_cache/

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags