Support » Fixing WordPress » get_post_type() and WooCommerce

  • Hi!

    I’m developing a site + store using Canvas theme and Woocommerce.

    Now, I’m trying to implement Zopim live chat just in store and regular pages (not into the blog). In the previous version of this site running WP-Commerce I did it using this code in the footer.php:

    <?php if ( is_page('') | is_post_type('wpsc-product') ) {?>
    <!--here goes the chat javascript-->
    <?php }?>

    Well, If I try this in woocommerce:

    <?php if ( is_page('') | is_post_type('product') ) {?>
    <!--here goes the chat javascript-->
    <?php }?>

    It breaks at is_post_type(”).

    So I tried via get_post_type() and a filter in the functions.php file:

    add_action( 'woo_footer_after', 'closefooterwrap', 10 );
    function closefooterwrap () {
        echo '</div>';
      $tipo = get_post_type();
        if ( is_page() | $tipo == 'product' ) {

    But get_post_type(); retursns ‘product’ type almost everywhere in the site! Even in blog post! So the chat displays everywhere. 🙁

    Anybody has got any idea about how to solve this?

    Thank you very much in advance.


Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘get_post_type() and WooCommerce’ is closed to new replies.