Forum Replies Created

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • in reply to: I can’t get Visitor conditions Custom function to work
    Jeff Rivett
    Participant

    Okay, thanks. That works as well.

    in reply to: I can’t get Visitor conditions Custom function to work
    Jeff Rivett
    Participant

    > You can remove [3][e].
    > That is not necessary.

    Nope. If I remove Visitor conditions: Custom function IS downloadclicked, the announcement appears on every page.

    Perhaps you could try this at your end to see what I’m seeing.

    Thanks,
    Jeff

    in reply to: I can’t get Visitor conditions Custom function to work
    Jeff Rivett
    Participant

    I don’t totally understand why it’s working, but I did get it working.

    [1] /wp-content/themes/<theme>/functions.php:

    add_action('wp_enqueue_scripts', 'jrc_enqueue_custom_js');
    function jrc_enqueue_custom_js() {
        wp_enqueue_script('jrcustom', get_stylesheet_directory_uri().'/js/jrcustom.js');
    }

    [2] /wp-content/themes/<theme>/js/jrcustom.js

    function downloadclicked(){}
    
    jQuery(document).ready(function(){
        jQuery( ".menu-item-4190" ).click(function() {
            var my_announcement = document.getElementById('ancr-4186').announcer;
            my_announcement.show(); // or .hide();
        });	
    });

    [3] Announcement (ID=4186)

    [a] Display: Immediately; Immediate; Slide
    [b] Position: Bottom; Sticky
    [c] Close: Display close; Keep closed NO
    [d] Location rules: Show in all pages
    [e] Visitor conditions: Custom function IS downloadclicked

    Thanks for your assistance.

    in reply to: I can’t get Visitor conditions Custom function to work
    Jeff Rivett
    Participant

    Perhaps it would help if I explained what I’m trying to accomplish.

    I would like an announcement to be shown when the user clicks a download link in the main menu (which appears on every page). Preferably, the announcement would appear after the download dialog, perhaps after a brief delay.

    Is there some way I can accomplish this without using Custom Function?

    in reply to: I can’t get Visitor conditions Custom function to work
    Jeff Rivett
    Participant

    Thanks for the information and suggestions.

    > In your case you are always returning true. So the announcement will be shown always (after closing the alert box)

    In fact the announcement is NOT shown. If I remove the Custom Function, the announcement does show up on every page (even without clicking). As soon as I enable the custom fuction, it stops appearing.

    I tried your suggested code, and the announcement still isn’t shown on clicking. If I remove the schedule settings you suggested, the announcement again appears on every page, regardless of any clicking.

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

Subscribe for updates

Get updates on the WordPress plugins, tips and tricks to enhance your WordPress experience. No spam. View newsletter