• Resolved rich95

    (@rich95)


    Hello;

    Great plugin!

    I use WooCommerce and would like to know if it’s possible to pass a URL to sort the products by likes &post_type=product.

    Similarly, I’d like to be able to use this for my portfolio in WooThemes Canvas which also uses it’s own custom post type. Is this possible?

    Cheers!

    https://wordpress.org/plugins/i-recommend-this/

Viewing 1 replies (of 1 total)
  • Plugin Author Harish Chouhan

    (@hchouhan)

    Thanks @rich95 for your comment. I hope you leave a review at http://wordpress.org/support/view/plugin-reviews/i-recommend-this.

    Regarding your query, I am not sure about WooCommerce, as I have never tried using a custom query in my WooCommerce template.

    But for any other post type, you can create a custom query and add a meta key for the sorting order.

    <?php
        $featured_posts = new WP_Query( array(
            'post_type' => 'post',
            'posts_per_page' => 10,
            'meta_query' => array(
                array(
                    'key' => '_recommended'
                )
            )
        ) );
    
        if ( $featured_posts->have_posts() ) : while ( $featured_posts->have_posts() ) : $featured_posts->the_post();
    
            //output featured posts here
    
        endwhile; endif;
    ?>

    This is not complete so you will need to experiment with it.

Viewing 1 replies (of 1 total)
  • The topic ‘Sort by likes for custom post type in URL’ is closed to new replies.