• Resolved Pirate Tayls

    (@pirate-tayls)


    Using this shortcode for the new products section.

    [products limit=”6″ columns=”2″ orderby=”id” order=”DESC”]

    With the new update (3.3.1), I cannot get the orderby to work correctly. It list items by SKU number. I can change the limit, I can add a category, those both work fine.

    But orderby doesn’t seem to work, not with id or date.

    Any help would be appreciated.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Caleb Burks

    (@icaleb)

    Automattic Happiness Engineer

    Ordering by ID, date, and title are all working for me. I think you might have problems because of your quotes. Make sure you use simple quotes.

    
    [products limit='6' columns='2' orderby='id' order='desc']
    
    • This reply was modified 6 years, 9 months ago by Caleb Burks.
    Thread Starter Pirate Tayls

    (@pirate-tayls)

    Thanks! That turned out to not be the problem, but it did make me dig deeper, because it seemed the shortcode wasn’t the problem. Turns out the site developer had added a function to change the default sort order, and that was overriding the shortcode.

    On the other hand, you were correct, single quotes are what I should have used.

    Hi,
    I’m dealing with the same issue, perhaps you could help me?

    I have a snippet to change the default sort order for woocommerce products, which I would like to keep. However, for the [products] shortcode, there are times when I would like to change the order from DESC to ASC.

    This is the snippet I use:

    add_filter('woocommerce_get_catalog_ordering_args', 'am_woocommerce_catalog_orderby');
    function am_woocommerce_catalog_orderby( $args ) {
        $args['order'] = 'DESC';	    
        }
        $args['orderby'] = 'meta_value_num';
        return $args;
    }

    For a certain shortcode, I would like to be able to change the order to ASC. It could probably be done with a if argument, but I’m not sure how to do it.

    Example shortcode:
    [products columns="6" limit="6" category="forthcoming" orderby="date" order="ASC" class="nyabocker-startsidan"]

    Any help would be appreciated!

    Johannes

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Shortcode only partially working’ is closed to new replies.