How to Create an Automatic Share Buttons Display Method Using Existing Actions or Filters?

Article sections

    Introduction

    Easy Social Share Buttons for WordPress has more than 30 automatic display methods included but that sometimes is not enough. To provide maximum flexibility we introduce the one of a kind integration menu for creating custom display positions. The integration menu allows you to create a display position for share buttons (like the build inside plugin) associated with an action or filter supported by your theme (or plugin you are using). With the integration menu, you can also create a theme integration point. That theme integration for share buttons will work like other methods that you can use (with a shortcode or function call) but it will appear inside the display positions of the plugin and it will have all the visual options that each location has.

    The most important advantage of using developer tools integration to create a custom display method for share buttons is that it will work like all existing display methods. Whenever you need to stop share buttons from appearing or change the style you can visit and do this like all other methods – no need to edit code.

    How to Activate Custom Hook Integrations

    To activate the custom hook integrations inside plugin you need to open Activate/Deactivate Features -> Developer Functions and Activate the option for Activate filter/action integration. 

    How to Create an Automatic Share Buttons Display Method Using Existing Actions or Filters? 1

    How to Create an Automatic Share Buttons Display Method Using Existing Actions or Filters? 2

     

    When you do this save the settings and reload page – you will see a new menu appearing “Developer Tools” where all integration options are present.

    How to Create an Automatic Share Buttons Display Method Using Existing Actions or Filters? 3

    How to Create a New Integration Point

    To create a new integration point you need to open the Developer Tools menu and fill all the fields inside the screen with proper information. Inside this screen, you will see also all existing integrations you have already made with the option to edit or remove.

    • Integration ID – this is a unique ID that plugin will use to identify the appearance of buttons and run the code. We recommend if you do a filter/action integration to fill in the filter or action in here. If you duplicate and ID the previous integration will be removed so fill it with caution. For ID use only Latin characters and numbers (no special characters or spaces).
    • Integration Name – this is the name you will see inside Display Positions and Display Position Settings. Set something that will help you identify it fast but please do not fill a too long text
    • Integration Type – with the selection here you choose how the position will work. If you do the integration for action or filter that comes with the theme/plugin select the appropriate value from the menu. If you are doing a custom theme integration point than you need to choose “Custom Position”
    • Action/filter name – that field is required only if you are doing a theme/plugin action or filter integration. Inside this field, you need to set the action/filter name that will be used exactly as you see it inside the connecting plugin/theme

    If you select to make a custom position inside the integration menu than you need to include the following code where you need share buttons to appear (replace integration_id with your ID you fill when creating the custom position):

    <?php if (function_exists("essb_hook_integration_draw")) { essb_hook_integration_draw("integration_id"); } ?>

     

    Example: Integrating Automatic Share Button Appearance in WooCommerce Shop or Archive Page

    To illustrate how easy is to integrate buttons we will give you a real-life example used by many of our customers. With that setup, you can easily show share buttons on your shop list page or archive (category) pages like the screenshot below.

    To do this inside the integration menu you need to select the following options:

    • Integration ID – woocommerce_after_shop_loop_item
    • Integration Name – Show Share Buttons on Shop Pages
    • Integration Type – Action
    • Action/filter name – woocommerce_after_shop_loop_item

    When you save the settings you will be able to activate the integration from display positions when you need to show share buttons:

    You will also have a full set of customization options like all other display positions where you can change active social networks and all other design-time options

    Was this article helpful?
    YesNo
    in Share Button DisplayDevelopers
    Was this article helpful?
    YesNo