Community Forums › Forums › Archived Forums › Design Tips and Tricks › Show ALL products in one page (remove pagination)
Tagged: foodie pro, posts per page, pre_get_posts, WooCommerce
- This topic has 4 replies, 3 voices, and was last updated 5 years, 2 months ago by Fabio.
-
AuthorPosts
-
August 3, 2019 at 2:10 pm #492783FabioParticipant
Hello,
If you look at my website home page
http://once.ly/CJhgc
(to protect my privacy I am using a temporary URL shortener)
you will notice at the bottom there is a 1-2-3 pagination.I don't like that and want all products to be shown in one page. Or at least to be able to choose how many products per page will be shown.
I tried both this:
/** * Change number of products that are displayed per page (shop page) */ add_filter( 'loop_shop_per_page', 'new_loop_shop_per_page', 20 ); function new_loop_shop_per_page( $cols ) { // $cols contains the current number of products per page based on the value stored on Options -> Reading // Return the number of products you wanna show per page. $cols = 9; return $cols; }
and this:
add_filter( 'loop_shop_per_page', 'wc_redefine_products_per_page', 9999 ); function wc_redefine_products_per_page( $per_page ) { $per_page = 100; return $per_page; }
and they did not work.
Any ideas?
http://once.ly/CJhgcAugust 3, 2019 at 4:53 pm #492784AnitaCKeymasterFoodie Pro is third-party theme developed by Feast Design Co. They have their own support area here. You probably need to check the existing code in functions.php or another file to see if there is existing function to set that. You may need to place your code higher up the page (at a higher priority) for the code to work. If you are unable to get that resolved, reach out to Feast.
Need help with customization or troubleshooting? Reach out to me.
August 3, 2019 at 6:14 pm #492788FabioParticipantYes Foodie pro is a third party theme but if you email them they will say that this question is out of the scope of their support (which is to recreate a demo like website). Since I bought foodie pro here on studiopress and I have been a studiopress customer for almost 10 years, I thought I'd get an answer in this forum. But truth be told, I didn't have much hope. I noticed that after 2014 this forum has gown downhill. Nevermind.
August 4, 2019 at 1:28 am #492791Brad DaltonParticipantFabio
Use pre_get_posts with the posts_per_page parameter like this :
add_filter( 'pre_get_posts', 'your_function_name' ); function your_function_name( $query ) { if ( ! is_admin() && $query->is_main_query() ) { $query->set( 'posts_per_page', -1 ); } }
By the way, these are community forums. StudioPress do not provide a free custom coding/theme modification service.
You have received more than a point in the right direction from several community volunteers more than 60 times over the last 6 years.
August 4, 2019 at 12:11 pm #492794FabioParticipantYou have received more than a point in the right direction from several community volunteers more than 60 times over the last 6 years.
2% of which were useful. Mostly before 2014.
You can say what you want, the truth is that before 2014 there were many people in this forum that made it look like they cared. It was like a forum should be.
Now this forum just got populated with web developers trying to catch newbie studiopress fish who "don't want to touch any code" and charging them to click the "install" button on wordpress, or charging them to click the "import demo" button. Features that even my cat could do in less than 9 seconds with eyes closed. You can generally recognize these scammers from their signature.
I'm not saying this is you, because actually you did help in the past, but all the others are just like that. Nevermind. I pointed this to studiopress headquarters a few times. Hopefully they will discourage this and make this forum a forum again.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.