action hook useage

Home Forums Store Locator Plus action hook useage

Tagged: 

This topic contains 3 replies, has 1 voice, and was last updated by  marine 3 years, 8 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #17868

    marine
    Participant

    Hi, We want to add some functionality to the plugin.

    The first thing is to add some jQuery that adds a disclaimer the client must accept.

    What I’m not clear on is the hook system for SLP. Do I  use any SLP hooks in my custom-functions.php ?

    What I want to avoid is losing any work when the plugin gets updated.

    #17934

    marine
    Participant

    there are 2 things i’d like to do here . . .

     

    1. Add some jquery, but it shouldn’t get loaded until after the /plugins/store-locator-le/js/slp.js

    if I add it like this from my custom_functions.php it gets added in the footer but still gets added before the slp.js, I need it to be after

    wp_enqueue_script(‘slp_dislaimer’,get_theme_root_uri() . ‘/mytheme/js/slp_disclaimer.js’,array(‘jquery-ui-dialog’),’1.0.0′,true);

    2. Add some custom html to the initial slp page on the front end. This would just be a couple of divs that would  display the disclaimer. I’ve tried using the CreatePageContent function and some others, but that obviously isn’t the right area to look in.

     

    Thanks for any help.

    • This reply was modified 3 years, 8 months ago by  marine.
    #17936

    marine
    Participant

    okay I got #1 working as is, and put the html in the jquery.  So i don’t need to #2 add the custom html.

    But how can I load the jQuery ONLY when the SLP results page is called?  AS of right now of course this script gets enqueued on all pages.

     

    Thanks.

    #17955

    marine
    Participant

    In case it helps someone else here is how I got some additional javascript to load from an external file when the SLP map page displays. Hope this helps, YMMV.

     

    function slp_disclaimer_enqueue_script(){

    wp_enqueue_script( ‘my_slp_disclaimer’ , get_theme_root_uri() . ‘/mytheme/js/slp_disclaimer.js’ , array(‘jquery’,’jquery-blockui’) , ‘1.0’ , true );

    }

    add_action( ‘slp_render_map’ , ‘slp_disclaimer_enqueue_script’ );

     

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.