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.
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".
"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").
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.
"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.
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.
"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 🙂