New Landing How can we help? Themeforest Theme Support Neighborhood spb_products shortcode 'per_page' argument

Viewing 8 posts - 1 through 8 (of 8 total)
  • #191294
    Stephen
    Member
    Post count: 44

    Could you add a ‘per_page’ argument to the [spb_products] shortcode?

    It’s a native WooCommerce shortcode argument, more info here.

    This will enable us to specify when pagination should kick in for pages on which the shortcode is used. I’ve tested it out and it doesn’t appear to be included with the [spb_products] shortcode as it stands.

    If your wondering what the use case is for this – I have a page on which I am displaying all featured products from a specific category. The number of featured products could end up being quite high, so I would like pagination to eventually kick in.

    The only display method I have currently is to show an unlimited number of products on a single page.

    Thanks.

    #191332
    David Martin – Support
    Moderator
    Post count: 20834

    Hi,

    Thanks for the suggestion, I’ll feed this back for future improvement.

    To help you out in the meantime, you could amend the WP_Query args for the shortcode to suite your needs.

    The file is named sf-products.php, look for the function sf_product_items() you could overwrite this in your child theme.

    Specificly in your case, you would want to look for this and update as you need :

    else if ($asset_type == "featured-products") {
    	$args = array(
    		    'post_type' => 'product',
    		    'post_status' => 'publish',
    		    'product_cat' => $category,
    		    'ignore_sticky_posts'   => 1,
    		    'meta_key' => '_featured',
    		    'meta_value' => 'yes',
    		    'posts_per_page' => $item_count
    		);
    }
    

    Thanks.

    #192614
    Stephen
    Member
    Post count: 44

    Was this functionality included with the latest update?

    #192633
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    You can override and update this functions through child so dont need to include this change in theme update.
    Thanks
    Mohammad

    #192671
    Stephen
    Member
    Post count: 44

    But David mentioned you’d include it in the future?

    If you are choosing to renege on that, could you supply me with the exact function to achieve it?

    #192679
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    I just suggested only that if we make any changes through child then we dont need to update in parent theme. This is a good way to use child for custom changes.
    Thanks
    Mohammad

    #192689
    Stephen
    Member
    Post count: 44

    Sorry, I’m not following.

    I haven’t yet included this in my child theme.

    To do so I’d need the exact function that I’m required to use – as I understand it, the function provided above requires some amendments before it will work properly?

    #192715
    David Martin – Support
    Moderator
    Post count: 20834
    This reply has been marked as private.
Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register