Home › Forums › WoodMart support forum › Load More Posts button malfunctioning
Load More Posts button malfunctioning
- This topic has 20 replies, 2 voices, and was last updated 6 months ago by Hung Pham.
-
AuthorPosts
-
May 29, 2024 at 3:15 am #568888
josh-6874ParticipantI placed “Load more posts” button on the main page but it fails to load older posts properly.
It displays duplicated blog posts and forever remains at loading status.
Please refer to the screenshot video for details.- This topic was modified 6 months, 2 weeks ago by josh-6874.
Attachments:
You must be logged in to view attached files.May 29, 2024 at 3:17 am #568890May 30, 2024 at 9:25 am #569213
Hung PhamKeymasterHi josh-6874,
Thanks for reaching to us.
First of all, I’m really sorry have taken long time to reply you.
You should deactivate all plugins (except Required Plugins) and then reactivate them one by one. This makes it very easy to isolate the plugin causing problems.
Regards,
May 30, 2024 at 10:33 am #569282
josh-6874ParticipantI disabled all plugins but Woodmart Core and WPBakery Page Builder but the problem persists. Same symptom.
I configured the blog element to display 3 items in 3 columns but after adding a new blog post I am seeing 4 blog posts at once, the first one being a sticky post.May 30, 2024 at 1:12 pm #569417
Hung PhamKeymasterHi josh-6874,
To assist you in the best possible manner, I kindly ask that you please provide me temporary wp-admin info (wp-admin URL, username, password) to the Private Content area, this will allow me to thoroughly investigate and address your concerns more efficiently.
Regards,
May 31, 2024 at 3:33 am #569594
josh-6874ParticipantPlease refer to the private section for login details.
May 31, 2024 at 7:51 am #569610
Hung PhamKeymasterHi josh-6874,
Thanks for details.
There are many errors in Console log related to JS issue https://prnt.sc/NleqO2-wplO8
You should deactivate all plugins (except Required Plugins) and then reactivate them one by one. This makes it very easy to isolate the plugin causing problems.
Regards,
May 31, 2024 at 8:55 am #569620
josh-6874ParticipantI reinstalled WordPress, Woodmart theme and overwrote js files to counteract the JS issues you have addressed.
Then I disabled all plugins but Woodmart Core and WPBakery Page Builder but the problem persists.
The JS issues arise only when “Load more posts” JS is triggered.May 31, 2024 at 11:35 am #569687
josh-6874ParticipantBy editing the page and saving it again solved the issue. (I really have no idea what is going on here.)
The remaining issue is that the “number of items per post” under WPBakery does not consider the sticky blog post, and displays in addition to it. For example, if I make one blog post sticky and the the number of items per post to “3”, 4 blog posts appear instead of three. Can you help me fix this?May 31, 2024 at 12:44 pm #569716
Hung PhamKeymasterHi josh-6874,
Would you mind if I deactivate extra plugins for testing? Please confirm me back.
Regards,
June 3, 2024 at 3:07 am #570079
josh-6874ParticipantYes. It’s a development site. You may perform any tasks related to fixing the issue.
June 3, 2024 at 4:27 am #570085
Hung PhamKeymasterHi josh-6874,
You can put offset value to make it works properly. https://prnt.sc/8j7rc14l1Ghp
You should reactivate plugins one by one. This makes it very easy to isolate the plugin causing problems.
Regards,
June 3, 2024 at 4:37 am #570086
josh-6874ParticipantConfiguring Offset displays according to the “number of items per post” but offsetting (to “1” in this case) “hides” the latest blog post. The theme needs to consider the number of sticky blog posts when displaying the total number of blog posts configured by the page. The theme needs a fix, in my opinion.
June 4, 2024 at 3:40 am #570380
Hung PhamKeymasterHi josh-6874,
I’ve passed this topic to one of our developers, and I will let you know once get an answer.
Regards,
June 4, 2024 at 12:52 pm #570510
Hung PhamKeymasterHi josh-6874,
Please send:
– FTP info (server, username, password, port)
I will need to enable debug log to find root cause of issue.
Regards,
June 10, 2024 at 5:18 am #571619
josh-6874ParticipantI installed a plugin called “File Manager” which allows full access to WP files.
Please login and access the URL in the private section.- This reply was modified 6 months ago by josh-6874.
June 10, 2024 at 3:07 pm #571765
Hung PhamKeymasterHi josh-6874,
Please try to add the code below in the functions.php file in your child theme, let me know if it works correctly.
add_filter('pre_get_posts', function ( $wp_query ) { if ( is_admin() || $wp_query->is_main_query() || 'post' !== $wp_query->get('post_type') ) { return $wp_query; } $wp_query->set( 'ignore_sticky_posts', true ); return $wp_query; });
Regards,
June 11, 2024 at 5:04 am #571849
josh-6874ParticipantI added the code but there is no difference in how blog posts are displayed. It still displays four blog posts instead of three. The total number of posts need to include the number of sticky posts but it doesn’t.
June 11, 2024 at 12:58 pm #571987
Hung PhamKeymasterHi josh-6874,
This code actually works. In our theme, in order to display posts, we use the default functionality from WordPress https://developer.wordpress.org/reference/classes/wp_query/.
And as you can see from the documentation, sticky posts are not counted in the number of posts to be displayed on the page. So the provided custom code to make them behave like regular posts. Unfortunately, at this time it is not possible for the number of sticky posts to be counted in the number of output posts.
Hope it clears.
Regards,
June 13, 2024 at 5:32 am #572381
josh-6874ParticipantI changed the number of output posts to ‘6’ and it correctly displays 6 posts. It’s only when the output post is ‘3’ that the problem persists (In other words, it displays 4 posts, including one sticky post). Is there a reason for this behaviour?
June 13, 2024 at 1:08 pm #572503
Hung PhamKeymasterHi josh-6874,
As I explained above that a sticky post is Always displayed, and when you choose to display 3 posts, it displays 4 posts and that is correct. But when you select 4 posts, 4 posts will be displayed because the sticky post has the 4th position in the order https://monosnap.com/file/OLjcNJ6TpxYIJSKP3bd6tIUh8cOnjt, and it is already taken into account in the posts per page.
If the sticky post is the last on the list, then when displaying posts, 1 extra post will always be displayed. And if the sticky post is the first in the list, there will be no extra post.
Hope it clears.
Regards,
-
AuthorPosts
- You must be logged in to create new topics. Login / Register