[Support request] how to include jquery

Home Forums Support [Support request] how to include jquery

Home Forums Support how to include jquery

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #970458
    david

    Hi, I’d like to include the following jquery into my sites home page:

    $(“.test”).chosen({
    search_contains: false,
    enable_split_word_search: false
    });

    Please can you explain exactly where and what I need to insert for this to work

    Thanks
    David

    #970484
    David
    Staff
    Customer Support

    Hi there,

    simplest way is to add the script to a Hook Element:

    https://docs.generatepress.com/article/hooks-element-overview/

    Add the script like so:

    <script>
    jQuery(".test").chosen({
        search_contains: false,
        enable_split_word_search: false
    });
    </script>

    Select the WP_footer hook from the list and set your display rules to the Front Page.

    #970706
    david

    Hi David,
    Thanks for this, how do I “set your display rules to the Front Page.”

    Thanks
    David

    #970932
    David
    Staff
    Customer Support

    When editing the Hook element – go to the Display Rules tab – Select Location: Front Page.

    #970998
    david

    Hi David,
    Don’t see a “Display rules tab”

    Only options I see are Execute PHP, Disable Hook and Save Hooks

    Thanks

    #971206
    David
    Staff
    Customer Support

    Aah ok – looks like you’re still using the old Hooks module. You can enable Appearance > GeneratePress > Elements module then you should see Appearance > Elemements and they will have a Display Rules tab.
    Any old Hooks or Page Headers will appear in the Elements module under legacy.

    #971315
    david

    I now have Appearance > Elements, but all I see at the top of the page is:

    Add New, Legacy Page Headers, Legacy Hooks

    Clicking Legacy Hooks brings up my wp-footer hook

    #971318
    David
    Staff
    Customer Support

    Click Add New > Hook.
    This document shows the Hook Element settings:

    https://docs.generatepress.com/article/hooks-element-overview/

    #971429
    david

    ok, so now where do I put

    
    <script>
    jQuery(".test").chosen({
        search_contains: false,
        enable_split_word_search: false
    });
    </script>
    
    Do I place it in the empty box (with no title) above the settings bar
    
    #971435
    David
    Staff
    Customer Support

    Below the ‘Add New Element’ is the Title field, followed by the content field, where you add that code, which is above the settings bar

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.