Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter lochie1979

    (@lochie1979)

    The above code didn’t work. It only outputs the following:

    Posts navigation

    Older
    posts

    Both ‘Older’ and ‘Posts’ are on seperate lines and link to the same thing but there is no news.

    Thread Starter lochie1979

    (@lochie1979)

    Thank you, I will give this a try. Where would I edit to select to only show a certain category?

    • This reply was modified 8 years, 3 months ago by lochie1979.
    Thread Starter lochie1979

    (@lochie1979)

    still same issue but latest version of the code is:

    function product_list_by_category_name( $product_category_name ){
            $args = array( 'post_type' => 'product', 'product_cat' => $product_category_name );
    
        $loop = new WP_Query( $args );
    
        while ( $loop->have_posts() ) : $loop->the_post();
        global $product;
    
            $amount = get_post_meta($product->post->ID, '_price', true) . ' ' . get_woocommerce_currency();
           echo '<table width="400" border="0" cellspacing="0" cellpadding="2">';
            echo '<tr><td width="250"><div align="left"><!-- <a href="'.get_permalink().'"> --!>'. get_the_title() .'<!-- </a> --!></div></td><td width="150"><div align="left"> '. $amount .'</div></td></tr>';
     echo '</table>';
        endwhile;
    
        wp_reset_query();
    
    }
    
    /** SHORTCODE **/
    function product_list_by_category_name_shortcode( $atts ) {
            extract(shortcode_atts(array(
                    'product_category_slug' => ''
            ), $atts));
    
            return product_list_by_category_name( $product_category_slug );
    }
    
    add_shortcode( 'product_list_by_category', 'product_list_by_category_name_shortcode' );
    
    ?>
    Thread Starter lochie1979

    (@lochie1979)

    As a competitor of theres I doubt they’d part with it I’m afraid.

Viewing 4 replies - 1 through 4 (of 4 total)