Skip Navigation

[Resolved] Featured posts at the top of the list

This support ticket is created 7 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 6 replies, has 2 voices.

Last updated by Bochnacki 7 years, 3 months ago.

Assisted by: Luo Yang.

Author
Posts
#555594

I need to make the Featured posts at the top of the post.
I can do this, but the problem is that these Featured posts are not included in search results or sorting [wpv-heading]. They remain in their original order of adding them and are not filtered by parametric search.

I found a few threads on this topic, but in no way is there an effective solution to this problem, and my ideas have already ended ...

Please help.

#555625

Dear Bochnacki,

How do you setup the "Featured posts"?

If it is defined by a custom field, for example a custom numeric field "featured-posts", you will be able to order the view result by the value of field "featured-posts".

#555640

"How do you setup the "Featured posts"?" - You helped me do this 🙂
https://toolset.com/forums/topic/product-update-post-meta/page/2/#post-550607

"If it is defined by a custom field, for example a custom numeric field "featured-posts", you will be able to order the view result by the value of field "featured-posts"." - It is not defined by a custom field. It is defined with the "Payments" taxonomy (term - "intop").

#555887

According to the post you mentioned above:
https://toolset.com/forums/topic/product-update-post-meta/page/2/#post-550607
The "featured posts" is defined by a taxonomy term,

I assume you are going to achieve this:
Use a post view to list posts of custom post type, and sort the result by the taxonomy term, display the "featured posts" first.

The Views plugin is using wordpress class to query the posts, according to wordpress document:
https://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters
There isn't any option can order the result by the taxonomy terms, so there isn't such a built-in feature within Views plugin.
You might have already tried create two different post view, the first view display "featured posts", the second view display those non-featured posts, it is the best workaround, and as a result, Featured posts are not included in search results of the second view.

#555941

"You might have already tried create two different post view" - so I did

<!-- wpv-loop-start -->
                [wpv-view name="in-top-osobowe"]
	<wpv-loop>
                [wpv-post-body view_template="Loop item in Ogłoszenia - osobowe"]
	</wpv-loop>
	<!-- wpv-loop-end -->

"...and as a result, Featured posts are not included in search results of the second view." - I'm not sure we understand well - I want both views, first and second, to be included in the search results.

#556026

Yes, you can display a view result insider another view, just like the codes you mentioned above
https://toolset.com/forums/topic/featured-posts-at-the-top-of-the-list/#post-555941

But they are different view, it won't be able to achieve what you mentioned in the first post of this thread:
sort the results of two different view as a single view results.

And for parameter search, if you have setup the same URL parameter filters in both view, they should be able to work in both view.

I am in vacation, it will be some delay to answer your thread, please let me know if you need assistance from other supporters.

#556859

"And for parameter search, if you have setup the same URL parameter filters in both view, they should be able to work in both view." - Unfortunately it does not work. Maybe if there were only filters using the URL parameter to work, but I also have other filters.

However, the problem solved differently: $('li.in-top').prependTo("ul.posts-list");
I just have to figure out how to write it to continue working after reloading the page through AJAX.

Thanks and a great holiday 🙂