“Trending Posts” extension
-
In the “Trending Posts” extension, what query ID is used to display the trending posts?
Because I want to display trending posts using elementor.
I’ll put the query here so elementor can order by posts based on what’s trending in your extension.-
This topic was modified 4 years, 9 months ago by
Mushlih Almubarak.
-
This topic was modified 4 years, 9 months ago by
Mushlih Almubarak.
-
This topic was modified 4 years, 9 months ago by
-
Hello @mushlih
The Trending Posts extension sorts the posts or products by the number of comments or number of reviews.
Doesn’t it depend on the post view?
At the moment, we’re only querying the number of comments/reviews. We do plan on adding more functionality to this extension in the future π
If so, what query should I write in elementor to display popular posts from your plugin? because I want to display trending posts using elementor but order by popular from your plugin extension
Elementor has its own query guidelines, documented here — https://developers.elementor.com/custom-query-filter/
You’ll need to create a filter and give it an ID, after that, you’ll be able to place it inside the Elementor editor.
Thanks
Youβll need to create a filter and give it an ID
<?php // Filter for popular posts add_action( 'elementor/query/my_custom_filter', function( $query ) { // What query from your plugin should I put here to display the most popular posts? Example: mysqli_query(SELECT post_id FROM popular); } );-
This reply was modified 4 years, 9 months ago by
Mushlih Almubarak.
Any respond @cteduard ?
Hello @mushlih
Unfortunately, the email notification never came from your last reply.
I cannot give you a query example because every database and config is different. You can look on Google on how to select and sort the database contents in the front end. Here’s an article that might help you get started — https://www.databasejournal.com/features/mysql/article.php/3904531/The-10-Most-Common-MySQL-Queries.htm
Thanks
I already understand how to run SQL queries.
But what is the name of the database table created by your plugin to sort popular posts?@mushlih We do not create any additional DB tables to implement the posts sorting. Like @cteduard already told you, we sort posts by the number of comments and to implement that you don’t need anything from our side β everything’s already present in WordPress core.
Just have a look at the
orderbyargument forWP_Query, it describes all the details: https://developer.wordpress.org/reference/classes/wp_query/#order-orderby-parametersIn the Trending Posts extension we use
'orderby' => 'comment_count'. If you want more details, just have a look at the implementation file itself β theblc_get_trending_posts_value()function is the one responsible for querying posts in the correct order.Hope this helps.
Perfect @creativethemeshq! This answer is what I expected.
I have 1 more question, what is the difference between the “Trending Posts” extension and the “Popular/Recent Posts” in the “Widgets” extension?
For more details see this image.
Isn’t it the same to sort trending posts by comments?Hello @mushlih
The Trending Posts extension is a bar always present (depending on the display conditions!) throughout your website. It can be placed around the header or footer (Premium feature).
We’ve recently released a video showcasing our trending posts extension — https://www.youtube.com/watch?v=mqAW5UWx6OY
The Recent/Popular posts widget is simply a block that can be placed throughout the widget areas from Blocksy. They include the sidebar and the header or footer.
Hope this clarifies the situation.
Thanks
Does that mean the difference only in appearance? There is no difference in how to list/order by the popular post?
-
This reply was modified 4 years, 9 months ago by
Mushlih Almubarak.
Yes, the only difference is the appearance of the block.
Ok, thank you
-
This reply was modified 4 years, 9 months ago by
The topic ‘“Trending Posts” extension’ is closed to new replies.
