you can define a constant in wp.config.php or at the beginning of functions.php of your theme
if (!defined('CAROUSEL_CPT')) {
define("CAROUSEL_CPT", "post");
}
WP_Query('post_type=".CAROUSEL_CPT);//....
Related Posts:
- How do i calculate the total of values of custom fields in custom post types?
- List events by month
- Custom post type loops with different page templates
- How do you output custom code between posts in the loop?
- How to append element after thumbnail
- Display custom field of specific post where post title matches variable
- Create a random unique 6 digit number as custom field for custom post type
- Custom Post Type Taxonomies -Posts not showing in Category or Tag pages
- Very Slow Page – How to Optimize # of Queries?
- Custom Post Type Loop throws 500 error when used in widget
- How to make sure content doesn’t display if selection is empty
- CPT + CMB2: data not displaying for only first post in loop
- I would like to have different styles for my posts based on the content of each post
- Checking if Post Title is Unique as Loop Criteria
- Custom Tag Description unable to display just below and outside of the Loop
- Get custom post type’s fields in a while loop as variables
- Including all post id’s of a custom post type into an array
- How can I group posts by months and years?
- Loop increase number
- Using wp_query to modify the loop in index.php for a CPT
- Control content before and after custom post type loop
- Custom Post not working as expected
- How to pass a variable to get_template_part that’s updated every time the template part is called?
- Get data from PHP to JavaScript to set position of each post on front page
- foreach loop inside the loop creating duplicates in output
- Compare Two Custom Post Types Using The Same Custom Taxonomy
- How can I increase the post count for custom post types only?
- Show the categories the current post has
- Fetch data from two custom post types and create multidimensional array for output to html table
- Page that lists publications by classifying them by taxonomy
- CPT loop doesn’t seem to account for post date?
- Pagination not working in custom post type. Help
- when looping through custom post data not appearing
- Accessing download link from the loop with WP Download Manager Pro
- Custom Post Type has wrong label and is not found when called by a loop
- Combine multiple separate lists into one
- Looping to organize and display custom posts by category using PHP and WordPress
- Show parent category and subcategory once in while loop
- WordPress trying to query two custom types to get child from the parent
- Add active class to foundation 6 tabs while looping categories
- Display related post content and custom field content
- WordPress loop add heading before first of type
- How to make a shortcode for my WP_Query Loop? [duplicate]
- Strange behavior on WP_query
- get_post_meta for Custom Post Type ( CPT )
- WordPress query posts by custom post type not workng
- WordPress Custom Post Type and sort by Tags
- Posts without featured image using other post’s featured image
- Order by custom field attribute
- Looping taxonomy in taxonomy?
- Query Custom Post Type by Tag
- How do I filter a custom post type loop by a field?
- the_post() is printing titles in page footer
- Assign custom parameter to each post in query
- WP_Query Custom Post Type if Category ID Equals
- Custom WP_Query doesn’t display all posts
- Assign category a default post type
- Query & the_content() is showing in the header
- Create Array from custom post type to display a slider
- Not sure why this template for custom post type posts isn’t displaying anything. What’s missing?
- How to append a query string to pagination?
- Move Genesis Single Page/Single Post Title
- Is This Code Efficient – Or is there a better way?
- get parent content inside child posts
- 3 random images from custom post type, each in a div with a diffrent class
- Two column layout with alphabetical ordering
- Post loop count is not in order
- How to use a variable as a function name?
- Check IF single OR multiple custom data has been entered
- Listing custom post types on archive page with array
- get_pagination not working on a custom post type query (using WP_Query)
- How to Make infinite loop of post
- Get custom post type categories to show up in menus
- Saving fields in a drop-down in WordPress
- WP_Query with custom post type ID
- Displaying multiple post types on home page
- looping though custom post types and only return results in a given taxonomy
- Displaying custom post types as a gallery
- Shortcode leaves no space for other elements?
- How to conditionally add Custom Post Type to Front Page
- Assigning a category to a custom post type in WordPress
- Dynamically insert code to custom post type loop
- Show current custom taxonomy
- finding and using post type fields in WordPress
- I need to add a filter to prepend the term ‘National – ‘ to the post title if the post is tagged to multiple states
- hide specific div on single.php [closed]
- Is there a way to create two template for single custom post type page?
- How exclude or skip post type with get_next_post_link
- Having Issue on Ordering CPT by Custom Field In Custom WP Query
- WordPress: Custom User Role cannot access Custom Post Type | “Sorry, you are not allowed to access this page”
- Pagination not working on custom query on a page
- Loop through posts of only 2 statuses
- How do I add custom HTML to the content of an archive page’s posts?
- Looping Through Categories of a CPT
- Different options per post type in WP_Query
- After creating Custom post type by user delete old one
- Search Filter CPT, Custom Loop
- widget_posts_args not using the number of posts in widget
- Show message when query has no posts
- Create short URL with auto 301 redirect