fbpx

Need Help?

Here are some good places you cant start.

Whats New?

Get updated about all the good stuff!

wordpress-black-friday-deals
toggle-button-for-elementor
elementor-widget-library

Advanced Post Query

Introduction:
In this article, you will learn about various options and settings available in the Post Query Section for any Post Widget or Loop Widget in the widget library for example: Post Grid, Post Carouse, Post list, etc. 

1. Post Source #

Allows us to select the source for your posts output. These are the options available:

1

Custom Posts

This will filter the posts by all the settings applied Posts Query Section.

2

Manual Selection

Select specific posts to display by name. (can mix diffrent post types)

3

Related Posts

Show a list of posts related to the current viewed post.

4

Current Query Post

Used in an archive page to display posts from a WordPress query.

2. Post Types #

You can choose the relevant post type you want to display in your post widget. For example: posts, pages, products or any custom post post type. You can select more than one post type since this is a multi select field.

3. Include By #

You can choose the relevant post type you want to display in your post widget. For example: posts, pages, products or any custom post post type.

1

Include Sticky Posts

If this option is selected, posts which are configured as sticky will be included in the post list.

2

Get Only Sticky Posts

Show only posts which are configured as sticky posts.

3

Author

Show posts related to a specific author or multiple authors. Under this option you can also select logged in user.

4

Date

Include posts by a predefined date range or a custom date range.  Use custom fields for date ranges to override the default WordPress post date.

5

Post Parent

Show children posts of any given post parent.

6

Post Meta

Use meta key to show posts assigned only to those keys.

7

Most Viewed

Show the most viewed  posts by integrating with 'WordPress' popular posts plugin.

8

ID's from PHP function

Get post id's array from a PHP function.

9

ID's from Post Meta

10

ID's from Dynamic Field

4. Include By Term #

Show posts related to a specific taxonomy. For example assigned to a category.

1

Include By Terms Relation

This option is relevant only when more than one term is selected. If set to AND the post will need to be assigned both terms for example. If set to OR then it can be assigned to either terms.

2

Include Terms Children

Decide if to show children of a parent term in your selection.

5. Exclude By #

Choose specific posts that you would like to exclude from your selection by adding rules.

1

Terms

Exclude posts assigned to a specific term.

2

Current Posts

If the widget is displayed in a specific page or post you can exclude it from the selection.

3

Author

Exclude posts assigned to a specific author or multiple authors.

4

Post Without Featured Image

Exclude posts that do not have a featured image assigned to them.

5

Posts with current category

Exclude posts from the current viewed category in your selection.

6

Posts with current tags

Exclude posts from the current viewed tag in your selection.

7

Offset

Show posts only from a certain number. For example you have 50 posts in your selection if offset is set to 10 then you will see only 40 posts from post number 10.

8

Avoid Duplicates

If more than one post widget on the page do not show the same post more than one time on the page. If in your selection the widget finds a duplicate it will skip it.

9

ID's from Dynamic Field

6. Post Status #

This setting allows you to select the post status for post selection. You can select by published, pending review, private, future, draft or inherit.

 

7. Max Posts #

Set the number of maximum posts to display. If left empty will show up to 100 posts.

8. Order By #

This setting determines the order of the posts. Post ID, Date, Title, Slug, Author, Last Modified, Number Of Comments, Random, Unsorted, Menu Order, Parent Post, Preserve Posts In Order, Custom Field Value, Custom Field Value (numeric)

 

You can also determine the Order By Direction in a descending or ascending order.

9. Query ID #

Give your Query a unique ID to be able and filter it in the server side using add_filter() function. 

This is how you do it: 


				
					//modify the arguments here. 
//widget data is an array with all widget settings
function modifyMyQuery($args, $widgetData){

	
	return($args);
}

add_filter("my_query_additions", "modifyMyQuery",10,2);

				
			

10. Show Query Debug #

This advanced mode will show the post query selection for debugging purposes. Don’t forget to turn it off before page release.

Download is just a click away

Get instant access to tons of Elementor goodies, completely FREE!

Hurray!

You got FREE access to the worlds leading widgets for Elementor page builder!