php - How can I Split Search Results into Post Types Tabs on Frontend? -


I have a WordPress installation; I have around 3 x custom post types on my site when I do a search All post types are displayed on Front Page at 1 page. Some post types are completely different from others' content, so the results look a little funny.

Is there a way to break the tab in the result according to the post type? I want to leave the result as default (all results) by default, but after that type of post type there are tabs to filter out individual results.

I have made a JPEG here, help me to clarify what I am actually trying to do.

Thanks

Enter the image details here </ P> <p> <strong> Update 1: </ strong> Just wanted to add a little bit more information on the code side </ p> <p> I had plans to use shortcodes as tabs < [Tab] [Tab] All search results [/ tab] [Tab] Post type 1 result [/ tab] [tab] Post type 1 result [/ tab] [tab] Post type 1 Results [/ tab] [tab] </ code> </ pre> <p> or in the PHP template I </ p> <pre> <code> & lt; Php post type 1 result [/ tab] [tab title =

I am thinking that there is something here that can help me, but not how to implement it

Update 2 : The other advice I have received on another forum, is to try the code like this, but I guess it can not correctly implement your search template on php

suggested Gone code

   1); $ My_posts2 = get_posts ($ args2); Echo do_shortcode ('[tabs style = "boxed" id = "searchTabs"] [tab title = "post type 1"] & lt ?? Php // This code is for the first post type foreach ($ myposts $ post): 
  • Lt; / li & gt; & lt ;? php endfin;; & gt; [/ tab] [tab title = "post type 2"] & lt ;? php // this code is the second post type foreign currency ($ myposts2 $ Post is in the form of: setup_postdata ($ post);? & Gt;
  • Comments

  • Popular posts from this blog

    Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

    java - How not to audit a join table and related entities using Hibernate Envers? -

    mongodb - CakePHP paginator ignoring order, but only for certain values -