If you are trying to alter your main query have a look at query_posts().
You should be able to achive all you need using query parameters without writing custom queries: WP_Query->orderby & WP_Query->date_query.
Related Posts:
- Tips for using WordPress as a CMS? [closed]
- Custom Post Type Templates from Plugin Folder?
- How to Remove Certain Screen Options and Meta Boxes from add/edit post type?
- Is it possible to define a template for a custom post type within a plugin independent of the active theme?
- Help making my pagination plugin better
- How to make a list of companies’ information and display them to user, using custom post types and a custom taxonomy?
- remove custom taxonomy metabox form custom post type
- [Plugin: Posts 2 Posts] reciprocal connections
- Custom Post Type Statuses
- add_meta_box Callback not being called
- Star rating for custom post types [closed]
- How to Make a Custom Grid View
- Get image URL from media library in input
- Way to hook into a sidebar call to replace it with a custom sidebar
- wordpress reusable content blocks
- Should i delete the posts created by a plugin on uninstall?
- how do i remove posts from a WP_Query so the pagination is right?
- Loco Translate: Custom Post and Custom Taxonomy Labels not translated in wp-admin menu
- Accessing post’s meta data based on user’s click of a post
- Dropdown menu on custom page with product to choose number of products per page
- Plugin custom post type – Internal server Error
- Is it possible to create Custom Post plug-in?
- List taxonomy terms for post as checkboxes
- more types plugin – display all post of post type on page
- When using Simple Fields plugin, how do I pull the information out of the database to display on a page?
- How to make a proper custom post type link
- Pagination Broken on Static Pages but Works on Blog Articles
- Matching Chapters to a Custom posts [closed]
- how to use in custom single.php template using php?
- Mq translate plugin custom post type issue
- pagination on data fetched using SQL query
- What is the best way for showing a grid of customer logos?
- How to apply next/previous classes to LIs for pagination links?
- WordPress custom taxonomy not showing
- Using ACF default value to autoincrement a number field
- Replacing global wp_query
- How to Resize the Custom Post Images?
- How to use template_include hook with form submission?
- Trying to add a page template for my custom post type from a plugin, but it will not display in the template dropdown unless file is in theme
- posts from multiple post types in one slider
- Custom Post Type – custom form in dashboard
- $pages = get_pages(‘child_of=’.$post->ID); Why arguments are concatenated?
- WP-API Custom Post Type json_no_route
- How can I list custom post type categories of portfolio
- Plugin generated unexpected output – No PHP errors
- “Allowed memory size” problem [closed]
- Use jQuery Datepicker code from plugin
- Posts 2 Posts: Display custom types connected to the same other custom type but with another connection
- “After file loaded” action
- Including content from legacy app: via plugin or custom content?
- Dictionary-style definition list plugin
- Custom Post Type, Custom Columns List
- Error Metabox Warning: call_user_func() expects parameter 1 to be a valid callback
- Import Recent Posts Only and Ignore old ones if exist
- need click to clipboard button on my site
- WordPress REST API: Query media files attached to a custom post type
- How to get the custom field value using SQL query
- Setting Author on CPT
- how to show all posts of each category in pages
- Custom Post Type same name as Category
- Create category for each user
- Adding category base to url in custom post giving 404?
- How to display the category name in the tab and post inside the tab in WordPress?
- Want to build parent-child relationships between custom post types created with CPT UI
- custom post type plugin error [closed]
- How to display the custom post related blog by category?
- Add an action based on custom post meta field
- Problem with checked box on wp car manager plugin
- Merging new theme and plugins from development site to production
- Ultimate Members Default Post Layout problem
- Is it possible to customize a wordpress post from outside dashboard(Something like site.com/post-type/post/?e=post_id)?
- Calling an custom field from theme option at the frontend
- Creating themes using the one Plugin (Toolkit)
- How to add jquery to my custom post type wp plugin
- WordPress list child pages of custom post type
- making a glossary with wordpress
- Wp Pagenavi how to display all results
- Create custom fields on a post
- Synch Custom Post Types (and Custom Fields, Cats, etc.) Between WordPress Sites
- get_option include in my adsense
- WordPress Custom post type won’t save properly
- featured image problem with custom post type
- wp_pagination not displaying at top of page
- How can I default a new post to being saved?
- Remove base from the custom post type URL [duplicate]
- Next and Previous Pagination button not displaying in WordPress
- Change the behaviour of archive cpt category and single cpt by plugin, not by theme
- A plugin for software reviews site like this one?
- Infinite scroll for text in post with url page change
- Display Custom Post Type and Custom Taxonomy Data on Front End Using Only a Plugin
- WordPress show different custom post type
- How to create load more button without a plugin?
- Links not opening as they should. Custom WP plugin
- How to export post tags from wordpress
- How to access the page without registering in wordpress
- CPT template is not being automatically used single post pages
- How to provide page_template path in custom plugin using WordPress
- Create CPT on Ajax Call
- My site has only one page, and users access my uploaded mp3 files from there – can I analyze access by song title?
- How do I know if an archive correspond to a custom post type taxonomy?