WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
Video on category pages (2 posts)

  1. kuleszas
    Member
    Posted 9 months ago #

    <?php
    
    if ( is_category( \'shop/' ) ) {
    ?>
    
    // <iframe width="560" height="315" src="//www.youtube.com/embed/rxX9PRhvIL0?list=PL959AE597E59B6863" frameborder="0" allowfullscreen></iframe>
    
    <?php
    }
    
    ?>

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

    and am pasting in into my archive-product.php file.

    I am getting this error:

    Parse error: syntax error, unexpected '(', expecting T_STRING or T_VARIABLE or '$',

    What is wrong with my code?

    http://wordpress.org/plugins/woocommerce/

  2. kuleszas
    Member
    Posted 9 months ago #

    Thia code works!

    <?php
    
    function woo_add_video_on_category_page() {
    
        if ( is_product_category( 'posters' ) ) {
            echo '<iframe width="560" height="315" src="//www.youtube.com/embed/rxX9PRhvIL0?list=PL959AE597E59B6863" frameborder="0" allowfullscreen></iframe>';
        }
    
    }
    
    add_action( 'woocommerce_before_shop_loop', 'woo_add_video_on_category_page' );
    
    ?>

Reply

You must log in to post.

About this Plugin

About this Topic