NOTES: Sorting / Post Ordering

Displaying Custom Post Type Using Default Archive Template

First, you can simply go to Appearance » Menus and add a custom link to your menu.
This custom link is the link to your custom post type.

If you are using SEO friendly permalinks then your CPT’s URL will most likely be something like this:

example.com/movies

If you are not using SEO friendly permalinks, then your custom post type URL will be something like this:

example.com/?post_type=movies

it will display your custom post type archive page using the

archive.php template file in your theme.

CREATE NEW TEMPLATE TO DISPLAY:::

Using Custom Templates for CPT Archives and Single Entries
If you don’t like the appearance of the archive page for your custom post type, then you can use dedicated template for custom post type archive.

To do that all you need to do is create a new file in your theme directory and name it archive-movies.php. Replace movies with the name of your custom post type.

For getting started, you can copy the contents of your theme’s archive.php file into archive-movies.php template and then start modifying it to meet your needs.

Now whenever the archive page for your custom post type is accessed, this template will be used to display it.

Similarly, you can also create a custom template for your post type’s single entry display. To do that you need to create single-movies.php in your theme directory. Don’t forget to replace movies with the name of your custom post type.

You can get started by copying the contents of your theme’s single.php template into single-movies.php template and then start modifying it to meet your needs.

DISPLAY AMONG REGULAR POSTS:::::

then you can do so by adding this code into your theme’s functions.php file or a site-specific plugin:

add_action( ‘pre_get_posts’, ‘add_my_post_types_to_query’ );

function add_my_post_types_to_query( $query ) {
if ( is_home() && $query->is_main_query() )
$query->set( ‘post_type’, array( ‘post’, ‘movies’ ) );
return $query;
}
Don’t forget to replace movies with your custom post type.

QUERY IN LOOP:::::::

Querying Custom Post Types
If you are familiar with the coding and would like to run loop queries in your templates, then here is how to do that (Related: What is a Loop?).

By querying the database, you can retrieve items from a custom post type.

<?php
$args = array( ‘post_type’ => ‘movies’, ‘posts_per_page’ => 10 );
$the_query = new WP_Query( $args );
?>
<?php if ( $the_query->have_posts() ) : ?>
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<h2><?php the_title(); ?></h2>
<div class=”entry-content”>
<?php the_content(); ?>
</div>
<?php wp_reset_postdata(); ?>
<?php else: ?>
<p><?php _e( ‘Sorry, no posts matched your criteria.’ ); ?></p>
<?php endif; ?>
In this code, first, we have defined the post type and posts per page in the arguments for our new WP_Query class.

After that, we ran our query, retrieved the posts and displayed them inside the loop.

USER WIDGET TO DISPLAY::::::

Displaying Custom Post Types in Widgets
You will notice that there is a default widget in WordPress to display recent posts, but it does not allow you to choose a custom post type.

What if you wanted to display the latest entries from your newly created post type in a widget? There is an easy way to do this.

First thing you need to do is install and activate the Ultimate Posts Widget plugin. Upon activation, simply go to Appearance » Widgets and drag and drop the Ultimate Posts widget to a sidebar.

Ultimate posts widget

This powerful widget will allow you to show recent posts from any post types. You can also display post excerpts with a read more link or even show a featured image next to post title.

Configure the widget by selecting the options you want and by selecting your custom post type. After that save your changes and see the widget in action on your website.

RSS / MORE WAYS TO DISPLAY:::

There is so much more you can do with your custom post types. You can learn to add your custom post types in main
www.wpbeginner.com/wp-tutorials/how-to-add-custom-post-types-to-your-main-wordpress-rss-feed/
RSS feed or create a
www.wpbeginner.com/wp-tutorials/how-to-make-a-separate-rss-feed-for-each-custom-post-type-in-wordpress/
separate feed for each custom post type.

For more hacks, see our list of the most useful WordPress custom post types tutorials.

If you’re looking for a no-code solution to customize your custom post type archive pages, then we recommend taking a look at a WordPress page builder plugin
www.wpbeginner.com/beginners-guide/best-drag-and-drop-page-builders-for-wordpress/
like Beaver Builder or Divi because they both can help you do that.

We hope this article helped you learn how to create custom post types in WordPress. You may also want to see our guide on how to increase your website traffic with practical tips.


Basic Custom Post Type – Issues / Solutions

www.wpbeginner.com/wp-tutorials/12-most-useful-wordpress-custom-post-types-tutorials/


Dynamic Menu Items – Custom Post Types

www.outsource-wordpress.com/custom-post-type-posts-in-menu-dynamically/


www.outsource-wordpress.com/custom-post-type-posts-in-menu-dynamically/

Custom Post Type Posts in Menu Dynamically

SIMPLE SUB MENU

[php] &lt;!–mep-nl–&gt;
&lt;!–mep-nl–&gt;function nacin_register_slideshows_post_type() {
&lt;!–mep-nl–&gt; &lt;!–mep-tab–&gt;register_post_type( ‘slideshow’, array(
&lt;!–mep-nl–&gt; &lt;!–mep-tab–&gt; &lt;!–mep-tab–&gt;’labels’ =&gt; array(
&lt;!–mep-nl–&gt; &lt;!–mep-tab–&gt; &lt;!–mep-tab–&gt; &lt;!–mep-tab–&gt;’name’ =&gt; ‘Slideshows’,
&lt;!–mep-nl–&gt; &lt;!–mep-tab–&gt; &lt;!–mep-tab–&gt; &lt;!–mep-tab–&gt;’singular_name’ =&gt; ‘Slideshow’,
&lt;!–mep-nl–&gt; &lt;!–mep-tab–&gt; &lt;!–mep-tab–&gt;),
&lt;!–mep-nl–&gt; &lt;!–mep-tab–&gt; &lt;!–mep-tab–&gt;’public’ =&gt; true,
&lt;!–mep-nl–&gt; &lt;!–mep-tab–&gt; &lt;!–mep-tab–&gt;’show_ui’ =&gt; true,
&lt;!–mep-nl–&gt; &lt;!–mep-tab–&gt; &lt;!–mep-tab–&gt;’show_in_menu’ =&gt; ‘edit.php’,
&lt;!–mep-nl–&gt; &lt;!–mep-tab–&gt; &lt;!–mep-tab–&gt;’supports’ =&gt; array( ‘title’ ,’thumbnail’, ‘editor’ ),
&lt;!–mep-nl–&gt; &lt;!–mep-tab–&gt;) );
&lt;!–mep-nl–&gt;}
&lt;!–mep-nl–&gt;add_action( ‘init’, ‘nacin_register_slideshows_post_type’ );
&lt;!–mep-nl–&gt;
&lt;!–mep-nl–&gt;
&lt;!–mep-nl–&gt;
&lt;!–mep-nl–&gt;
&lt;!–mep-nl–&gt;
&lt;!–mep-nl–&gt; /*————————————*\
&lt;!–mep-nl–&gt; &lt;!–mep-tab–&gt;ADD SIMPLE SUB MENU FOR CUSTOM FIELD
&lt;!–mep-nl–&gt; \*————————————*/
&lt;!–mep-nl–&gt;
&lt;!–mep-nl–&gt;
&lt;!–mep-nl–&gt;
&lt;!–mep-nl–&gt;function nacin_register_slideshows_post_type() {
&lt;!–mep-nl–&gt; &lt;!–mep-tab–&gt;register_post_type( ‘slideshow’, array(
&lt;!–mep-nl–&gt; &lt;!–mep-tab–&gt; &lt;!–mep-tab–&gt;’labels’ =&gt; array(
&lt;!–mep-nl–&gt; &lt;!–mep-tab–&gt; &lt;!–mep-tab–&gt; &lt;!–mep-tab–&gt;’name’ =&gt; ‘Slideshows’,
&lt;!–mep-nl–&gt; &lt;!–mep-tab–&gt; &lt;!–mep-tab–&gt; &lt;!–mep-tab–&gt;’singular_name’ =&gt; ‘Slideshow’,
&lt;!–mep-nl–&gt; &lt;!–mep-tab–&gt; &lt;!–mep-tab–&gt;),
&lt;!–mep-nl–&gt; &lt;!–mep-tab–&gt; &lt;!–mep-tab–&gt;’public’ =&gt; true,
&lt;!–mep-nl–&gt; &lt;!–mep-tab–&gt; &lt;!–mep-tab–&gt;’show_ui’ =&gt; true,
&lt;!–mep-nl–&gt; &lt;!–mep-tab–&gt; &lt;!–mep-tab–&gt;’show_in_menu’ =&gt; ‘edit.php’,
&lt;!–mep-nl–&gt; &lt;!–mep-tab–&gt; &lt;!–mep-tab–&gt;’supports’ =&gt; array( ‘title’ ,’thumbnail’, ‘editor’ ),
&lt;!–mep-nl–&gt; &lt;!–mep-tab–&gt;) );
&lt;!–mep-nl–&gt;}
&lt;!–mep-nl–&gt;add_action( ‘init’, ‘nacin_register_slideshows_post_type’ );
&lt;!–mep-nl–&gt;
&lt;!–mep-nl–&gt;
&lt;!–mep-nl–&gt;
&lt;!–mep-nl–&gt; /*————————————*\
&lt;!–mep-nl–&gt; &lt;!–mep-tab–&gt;ANOTHER SUB MENU FOR CUSTOM POSTS
&lt;!–mep-nl–&gt; \*————————————*/
&lt;!–mep-nl–&gt;
&lt;!–mep-nl–&gt;
&lt;!–mep-nl–&gt;add_filter( ‘wp_get_nav_menu_items’, ‘cpt_locations_filter’, 10, 3 );
&lt;!–mep-nl–&gt;
&lt;!–mep-nl–&gt;function cpt_locations_filter( $items, $menu, $args ) {
&lt;!–mep-nl–&gt; $child_items = array();
&lt;!–mep-nl–&gt; $menu_order = count($items);
&lt;!–mep-nl–&gt; $parent_item_id = 0;
&lt;!–mep-nl–&gt;
&lt;!–mep-nl–&gt; foreach ( $items as $item ) {
&lt;!–mep-nl–&gt; &lt;!–mep-tab–&gt;if ( in_array(‘locations-menu’, $item-&gt;classes) ){ //add this class to your menu item
&lt;!–mep-nl–&gt; &lt;!–mep-tab–&gt; &lt;!–mep-tab–&gt;$parent_item_id = $item-&gt;ID;
&lt;!–mep-nl–&gt; &lt;!–mep-tab–&gt;}
&lt;!–mep-nl–&gt; }
&lt;!–mep-nl–&gt;
&lt;!–mep-nl–&gt; if($parent_item_id &gt; 0){
&lt;!–mep-nl–&gt;
&lt;!–mep-nl–&gt; &lt;!–mep-tab–&gt; foreach ( get_posts( ‘post_type=cpt-post-type-here&amp;numberposts=-1’ ) as $post ) {
&lt;!–mep-nl–&gt; &lt;!–mep-tab–&gt; &lt;!–mep-tab–&gt;$post-&gt;menu_item_parent = $parent_item_id;
&lt;!–mep-nl–&gt; &lt;!–mep-tab–&gt; &lt;!–mep-tab–&gt;$post-&gt;post_type = ‘nav_menu_item’;
&lt;!–mep-nl–&gt; &lt;!–mep-tab–&gt; &lt;!–mep-tab–&gt;$post-&gt;object = ‘custom’;
&lt;!–mep-nl–&gt; &lt;!–mep-tab–&gt; &lt;!–mep-tab–&gt;$post-&gt;type = ‘custom’;
&lt;!–mep-nl–&gt; &lt;!–mep-tab–&gt; &lt;!–mep-tab–&gt;$post-&gt;menu_order = ++$menu_order;
&lt;!–mep-nl–&gt; &lt;!–mep-tab–&gt; &lt;!–mep-tab–&gt;$post-&gt;title = $post-&gt;post_title;
&lt;!–mep-nl–&gt; &lt;!–mep-tab–&gt; &lt;!–mep-tab–&gt;$post-&gt;url = get_permalink( $post-&gt;ID );
&lt;!–mep-nl–&gt; &lt;!–mep-tab–&gt; &lt;!–mep-tab–&gt;array_push($child_items, $post);
&lt;!–mep-nl–&gt; &lt;!–mep-tab–&gt; }
&lt;!–mep-nl–&gt;
&lt;!–mep-nl–&gt; }
&lt;!–mep-nl–&gt;
&lt;!–mep-nl–&gt; return array_merge( $items, $child_items );
&lt;!–mep-nl–&gt;}
&lt;!–mep-nl–&gt;
&lt;!–mep-nl–&gt;
&lt;!–mep-nl–&gt;
&lt;!–mep-nl–&gt;[/php]

You may want to add your Custom Post Type posts dynamically in the menu as dropdown and here is the solution.

Step 1:

code.tutsplus.com/tutorials/understanding-the-walker-class–wp-25401

Paste the following code in your theme’s ‘functions.php’. This will utilize the WordPress menu Walker class – end_el function.

[php] &lt;!–mep-nl–&gt;/** function to display custom post type post’s of first level **/
&lt;!–mep-nl–&gt;class Walker_Dynamic_Submenu extends Walker_Nav_Menu {
&lt;!–mep-nl–&gt;function end_el(&amp;$output, $item, $depth=0, $args=array()) {
&lt;!–mep-nl–&gt;if( 100 == $item-&gt;ID ){
&lt;!–mep-nl–&gt;global $post;
&lt;!–mep-nl–&gt;$cptnames = get_posts(array(‘post_type’=&gt;’cptname’,’posts_per_page’=&gt;-1, ‘post_parent’ =&gt; 0));
&lt;!–mep-nl–&gt;if(!empty($cptnames)) {
&lt;!–mep-nl–&gt;$output .= ‘&lt;ul class="sub-menu"&gt;’;
&lt;!–mep-nl–&gt;foreach($cptnames as $post): setup_postdata($post);
&lt;!–mep-nl–&gt;$output .= ‘&lt;li&gt;&lt;a href="’.get_permalink().’"&gt;’.get_the_title().’&lt;/a&gt;’;
&lt;!–mep-nl–&gt;$output .= get_child_posts(get_the_ID());
&lt;!–mep-nl–&gt;$output .= ‘&lt;/li&gt;’;
&lt;!–mep-nl–&gt;endforeach; wp_reset_postdata();
&lt;!–mep-nl–&gt;$output .= ‘&lt;/ul&gt;’;
&lt;!–mep-nl–&gt;}
&lt;!–mep-nl–&gt;}
&lt;!–mep-nl–&gt;$output .= "&lt;/li&gt;\n";
&lt;!–mep-nl–&gt;}
&lt;!–mep-nl–&gt;}
&lt;!–mep-nl–&gt;[/php]

Replace cptname with your Custom Post Type name above.

Step 2:
Again paste the following code in your theme’s ‘functions.php’ if you have parent-child hierarchy for your Custom Post Type to display the children. You can skip this step if you don’t have hierarchy.

[php] &lt;!–mep-nl–&gt;/** function to display custom post type children posts **/
&lt;!–mep-nl–&gt;function get_child_posts($parent = 0) {
&lt;!–mep-nl–&gt;global $post;
&lt;!–mep-nl–&gt;$cptnameschild = get_posts(array(‘post_type’=&gt;’cptname’,’posts_per_page’=&gt;-1, ‘post_parent’ =&gt; $parent));
&lt;!–mep-nl–&gt;if(!empty($cptnameschild)) {
&lt;!–mep-nl–&gt;$outputchild .= ‘&lt;ul class="sub-menu"&gt;’;
&lt;!–mep-nl–&gt;foreach($cptnameschild as $post): setup_postdata($post);
&lt;!–mep-nl–&gt;$outputchild .= ‘&lt;li&gt;&lt;a href="’.get_permalink().’"&gt;’.get_the_title().’&lt;/a&gt;&lt;/li&gt;’;
&lt;!–mep-nl–&gt;$outputchild .= get_child_posts(get_the_ID());
&lt;!–mep-nl–&gt;endforeach; wp_reset_postdata();
&lt;!–mep-nl–&gt;$outputchild .= ‘&lt;/ul&gt;’;
&lt;!–mep-nl–&gt;}
&lt;!–mep-nl–&gt;return $outputchild;
&lt;!–mep-nl–&gt;}
&lt;!–mep-nl–&gt;[/php]

Again, replace cptname with your Custom Post Type name above.

Step 3:
Now we are in the final part – we need to append our Walker function to the WordPress menu items. Add this ,

[php] &lt;!–mep-nl–&gt;’walker’ =&gt; new Walker_Dynamic_Submenu to wp_nav_menu() – for example, wp_nav_menu( array( ‘theme_location’ =&gt; ‘top’, ‘menu_id’ =&gt; ‘top-menu’, ‘walker’ =&gt; new Walker_Dynamic_Submenu ) )
&lt;!–mep-nl–&gt;[/php]

RSS Feeds for Custom Post Types

WordPress comes with a built-in RSS generator for all content types, taxonomies, authors, and date based archives. It uses a proper URL structure that queries the database and generates the RSS feed you want to see.

For example, to see the RSS feed of your custom post type ‘movies’ you will add this URL:

www.example.com/feed/?post_type=movies

For more details, see how to make

www.wpbeginner.com/wp-tutorials/how-to-make-a-separate-rss-feed-for-each-custom-post-type-in-wordpress/
separate RSS feed for custom post types in WordPress.


You can easily include your custom post types into your main RSS feed by adding the following code to your theme’s functions.php file or a site-specific WordPress plugin.

[php] &lt;!–mep-nl–&gt;&amp;lt;!–mep-nl–&amp;gt;function myfeed_request($qv) {
&lt;!–mep-nl–&gt;&amp;lt;!–mep-nl–&amp;gt; &amp;lt;!–mep-tab–&amp;gt;if (isset($qv[‘feed’]) &amp;amp;&amp;amp; !isset($qv[‘post_type’]))
&lt;!–mep-nl–&gt;&amp;lt;!–mep-nl–&amp;gt; &amp;lt;!–mep-tab–&amp;gt; &amp;lt;!–mep-tab–&amp;gt;$qv[‘post_type’] = array(‘post’, ‘books’, ‘movies’);
&lt;!–mep-nl–&gt;&amp;lt;!–mep-nl–&amp;gt; &amp;lt;!–mep-tab–&amp;gt;return $qv;
&lt;!–mep-nl–&gt;&amp;lt;!–mep-nl–&amp;gt;}
&lt;!–mep-nl–&gt;&amp;lt;!–mep-nl–&amp;gt;add_filter(‘request’, ‘myfeed_request’);
&lt;!–mep-nl–&gt;&amp;lt;!–mep-nl–&amp;gt;[/php]

Replace books and movies with your own custom post types.

Learn more about how to add custom post types to main WordPress RSS feed.
www.wpbeginner.com/wp-tutorials/how-to-add-custom-post-types-to-your-main-wordpress-rss-feed/


Search and Custom Post Types

SearchWP which allows you to create advanced search forms and is capable of searching through all custom post types, taxonomies, and custom fields.

If you would rather prefer to build your own custom search form, then here is what you need to do. First add your custom post types hidden fields in the search form by adding this code in searchform.php file of your child theme.

[php] &lt;!–mep-nl–&gt;&amp;lt;!–mep-nl–&amp;gt;&amp;lt;input type="hidden" name="post_type[]" value="articles" /&amp;gt;
&lt;!–mep-nl–&gt;&amp;lt;!–mep-nl–&amp;gt;&amp;lt;input type="hidden" name="post_type[]" value="post" /&amp;gt;
&lt;!–mep-nl–&gt;&amp;lt;!–mep-nl–&amp;gt;&amp;lt;input type="hidden" name="post_type[]" value="videos" /&amp;gt;
&lt;!–mep-nl–&gt;&amp;lt;!–mep-nl–&amp;gt;&amp;lt;input type="hidden" name="post_type[]" value="books" /&amp;gt;
&lt;!–mep-nl–&gt;&amp;lt;!–mep-nl–&amp;gt;[/php]

This code simply adds hidden fields for your custom post types, replace value with your own custom post types. The next step is to tell WordPress what to do with these fields. Add this code before the loop in your theme’s search.php file:

[php] &lt;!–mep-nl–&gt;&amp;lt;!–mep-nl–&amp;gt;&amp;lt;form role="search" method="get" id="searchform" action="&amp;lt;?php echo home_url( ‘/’ ); ?&amp;gt;"&amp;gt;
&lt;!–mep-nl–&gt;&amp;lt;!–mep-nl–&amp;gt;&amp;lt;input type="text" name="s" id="s" &amp;lt;?php if(is_search()) { ?&amp;gt;value="&amp;lt;?php the_search_query(); ?&amp;gt;" &amp;lt;?php } else { ?&amp;gt;value="Enter keywords &amp;amp;hellip;" onfocus="if(this.value==this.defaultValue)this.value=”;" onblur="if(this.value==”)this.value=this.defaultValue;"&amp;lt;?php } ?&amp;gt; /&amp;gt;
&lt;!–mep-nl–&gt;&amp;lt;!–mep-nl–&amp;gt; &amp;lt;!–mep-tab–&amp;gt;
&lt;!–mep-nl–&gt;&amp;lt;!–mep-nl–&amp;gt;&amp;lt;?php $query_types = get_query_var(‘post_type’); ?&amp;gt;
&lt;!–mep-nl–&gt;&amp;lt;!–mep-nl–&amp;gt; &amp;lt;!–mep-tab–&amp;gt;
&lt;!–mep-nl–&gt;&amp;lt;!–mep-nl–&amp;gt;&amp;lt;input type="checkbox" name="post_type[]" value="articles" &amp;lt;?php if (in_array(‘articles’, $query_types)) { echo ‘checked="checked"’; } ?&amp;gt; /&amp;gt;&amp;lt;label&amp;gt;Articles&amp;lt;/label&amp;gt;
&lt;!–mep-nl–&gt;&amp;lt;!–mep-nl–&amp;gt;&amp;lt;input type="checkbox" name="post_type[]" value="post" &amp;lt;?php if (in_array(‘post’, $query_types)) { echo ‘checked="checked"’; } ?&amp;gt; /&amp;gt;&amp;lt;label&amp;gt;Blog&amp;lt;/label&amp;gt;
&lt;!–mep-nl–&gt;&amp;lt;!–mep-nl–&amp;gt;&amp;lt;input type="checkbox" name="post_type[]" value="books" &amp;lt;?php if (in_array(‘books’, $query_types)) { echo ‘checked="checked"’; } ?&amp;gt; /&amp;gt;&amp;lt;label&amp;gt;Books&amp;lt;/label&amp;gt;
&lt;!–mep-nl–&gt;&amp;lt;!–mep-nl–&amp;gt;&amp;lt;input type="checkbox" name="post_type[]" value="videos" &amp;lt;?php if (in_array(‘videos’, $query_types)) { echo ‘checked="checked"’; } ?&amp;gt; /&amp;gt;&amp;lt;label&amp;gt;Videos&amp;lt;/label&amp;gt;
&lt;!–mep-nl–&gt;&amp;lt;!–mep-nl–&amp;gt; &amp;lt;!–mep-tab–&amp;gt;
&lt;!–mep-nl–&gt;&amp;lt;!–mep-nl–&amp;gt;&amp;lt;input type="submit" id="searchsubmit" value="Search" /&amp;gt;
&lt;!–mep-nl–&gt;&amp;lt;!–mep-nl–&amp;gt;&amp;lt;/form&amp;gt;
&lt;!–mep-nl–&gt;&amp;lt;!–mep-nl–&amp;gt;[/php]

Chage post types

www.wpbeginner.com/plugins/how-to-convert-post-types/
Simply install and activate the Post Type Switcher plugin. Upon activation, go to Posts » All Posts. If it is a custom post type, then go to the screen that shows all items in that post type.


Using Custom Post Types as Taxonomies

Yes, you read that correctly, and you are probably thinking why use CPTs as taxonomies? Why not just create custom taxonomies? Let’s say that you have a custom post type for books and another custom post type for authors. Now you may want to associate authors with the books they have written. You can create a custom taxonomy for authors, but then you will have an authors taxonomy and a post type which only adds to the confusion.

wordpress.org/plugins/cpt-onomies/

Simply install and activate the CPT-onomies plugin. It allows you to build relationships between post types by using custom post types as taxonomy.

Using this plugin, the next time you add a book you can select the author as CPT-onomy and show all the books written by that author. Learn more about using custom post types as taxonomies.

www.wpbeginner.com/plugins/using-custom-post-types-as-taxonomies-in-wordpress-cpt-onomies/


Posts Table Pro – Full list of options

This is a complete list of all the options available in Posts Table Pro, with links to full instructions for each option.
You can use these to configure the [posts_table] shortcode in many different ways.

Table columns
columns – sets the columns in the table.
There are options to customize or remove the column headers
Choosing which posts appear in the table
There are lots of ways to create a table listing specific posts only:

category – lists posts from a specific category
tag – lists posts with a specific tag
post_type –
lists posts with a specific post type (e.g. products, events, or projects)
term –
lists posts with a specific custom taxonomy term
cf – lists posts with a specific custom field value
year – lists posts published in a specific year
month – lists posts published in a specific month
day – lists posts published on a specific day of the month
author – lists posts by a specific author/user
status – lists posts with a specific status (e.g. Published)
exclude – excludes specific posts from the table based on ID
include – lists specific posts in the table based on ID
exclude_category – excludes entire categories of posts from the table
rows_per_page – sets the number of posts on each page of the table
post_limit – sets the maximum number of posts that can appear in the table
Sorting & ordering
sort_by – controls how the posts are sorted when the table first loads
sort_order – sorts the table in ascending or descending order
filters – add filter dropdown lists above the table
search_term – filter by search term when the table first loads
Control elements above & below the table
search_box – shows, hides or positions the keyword search box
reset_button – shows, hides or positions the reset link
page_length – shows, hides or positions the “Show posts” dropdown list
totals – shows, hides or positions the post totals (e.g. “Showing 1 to 10 of 50 posts”)
pagination – shows, hides or positions the pagination buttons (previous, next etc)
paging_type – sets the pagination style
show_footer – shows or hides the footer row of the table
scroll_offset – changes the height that the page scrolls to when you move between pages in the table

Sizing & styling
widths – sets the width of each column
content_length – sets the number of characters in the ‘content’ column
excerpt_length – sets the number of characters in the ‘excerpt’ column

Images
image_size – sets the size of featured images in the table
lightbox – control whether your images open in a lightbox

Mobile visibility & responsive options
wrap – controls whether or not content is wrapped onto multiple lines
priorities – controls which columns are hidden on screen sizes when there are too many to fit on the page
column_breakpoints – provides fine-grained control over the breakpoints for each column when viewed on smaller screen sizes
responsive_control – controls the + icon which shows hidden rows
responsive_display – sets whether hidden rows are visible or hidden, or open in a modal window

Performance
lazy_load – improves performance by loading the overall page before the table, and loading 1 page of posts at a time
cache – whether to use caching to speed up table load time

Miscellaneous options
shortcodes – displays content generated by other shortcodes in the table (e.g. buttons or embedded audio or video players)
links – sets which columns in the table are clickable
search_on_click – controls whether clicking on a category, tag or custom taxonomy will filter the table or link to the relevant archive page
date_format – sets the date format for any date columns
date_columns – specifies which columns contain dates, so that the column can be sorted by date correctly
no_posts_message – controls the text that appears if no posts are found when the table first loads
no_posts_filtered_message – controls the text that appears if no results are found when a user searches or filters the table
numeric_terms – fixes any issues if you’re using numeric slugs for your categories or taxonomies

Posts table shortcode examples
To get you started, here are some popular examples of different ways to use Posts Table Pro.

Basic usage displaying all posts (see below for full list of columns):
[posts_table columns=”image,title,content,date,author”]

Display posts from a single category (use the category slug or ID):
[posts_table columns=”title,excerpt,tags” category=”news”]

Display posts from several categories. This example shows posts in the “ebooks” category or the “audiobooks” category: [posts_table category=”ebooks,audiobooks”]

Display posts that belong to several categories. This example shows posts that are in the “featured”, “course”, and “health” categories:
[posts_table columns=”name,short-description,tags,price,add-to-cart” category=”featured+course+health”]

Exclude posts from a category. This example excludes posts in the “clients” category:
[posts_table exclude_category=”clients”]

Display featured image. Defaults to 50 by 50 pixels, but you can specify a custom image size if you wish:
[posts_table columns=”image,title,content” image_size=”80×80″]

Choosing custom column headings:
[posts_table columns=”title:Post Name,content:Description,Author:Written By”]

What else can I do?
Please also see our articles on advanced usage, which include advice on adding tables to category archive or search results pages, translating the posts table into other languages, developer documentation, and more. We’ve also published a list of compatible third party plugins that you can use with Posts Table Pro.


code.tutsplus.com/series/mastering-wp_query–cms-818

this is what is driving it –

Plugins::

www.nsp-code.com/premium-plugins/

www.nsp-code.com/advanced-post-types-order-api/


barn2.co.uk/wordpress-plugins/posts-table-pro/

wplift.com/wordpress-document-library-plugin


Conductor::

conductorplugin.com/