• I’m trying to add via functions.php the following link to all pages in a Thematic child theme:

    <a href="#" onClick="window.open('https://foo.com', 'null', 'width=490, height=405, menubar=no, toolbar=no, scrollbars=no, location=0, directories=0, resizable=yes, status=0');return false">Live Chat</a>

    If I drop this code into the main content area of a page/post, it works fine. However, when I call it via functions.php, it fails.

    Here’s the function:

    // ADD LIVE-CHAT LINK
    
    function livechat() {
    $stylesheetdir = get_bloginfo('stylesheet_directory');
    echo '<div id="live-chat"><a href="#" onClick="window.open('https://foo.com', 'null', 'width=490, height=405, menubar=no, toolbar=no, scrollbars=no, location=0, directories=0, resizable=yes, status=0');return false">Live Chat</a></div>';
    }
    
    add_filter( 'thematic_belowheader', 'livechat' );

    Anybody know what I’m doing wrong? And, more importantly, can someone please tell me how to do it right?

    Thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add javascript onClick code to Thematic functions.php’ is closed to new replies.