if( get_post_type() == 'post_type_slug' ) {
//do some stuff
} else {
//do other stuff
}
Should do it, alternately you can use templates to handle that, which wordpress has setup pretty well by default. See the codex page on template hierarchy, specifically I find the visual overview to be quite useful.
Related Posts:
- How do test if a post is a custom post type?
- Display several random posts, but make sure a condition is met
- Exclude custom function content from certain pages
- Function like in_category for custom taxonomies
- Can I create a loop with multiple post types and specify different $args for each post type?
- Conditional PNG Overlay in Custom Post Type Loop Depending on Post Type
- Search filter triggered & sort by custom post type
- Conditional for a Single Post That Belongs to a Category?
- Dynamically output a class to an anchor tag depending on what tag is chosen
- Check IF single OR multiple custom data has been entered
- If custom taxonomy else conditional [closed]
- Checking for custom field in admin pages
- I’m trying to create an if statement that will only display my button link for tickets if its under ‘admission-event’… what is wrong with my code?
- How can I check the rewrite slug of current post type listing page
- Multiple domains, Single database, 1 Parent/Master with all content, other domains/slaves with filtered content (based on “location” variable)
- Display content based on Author Custom Post type
- Loop to pull content from parent element in custom post type [duplicate]
- How to set up a echo? [closed]
- Replacing the title in admin list table
- Can I change a custom post type label from a child theme?
- Hide custom post type field from author?
- WordPress keeps fetching the archive page instead of the template page
- Custom post type taxonomies URL rewrite
- Linking between custom post types as if they where taxonomies?
- Show custom post type endpoint in REST API just if user has capability
- List posts from Custom Post type with hierarchy?
- Search Custom Post Type with all meta attached?
- How Can the Users Make a “Playlist” of Posts?
- Glossary with Custom Post Type
- How to properly prefix blog post URL’s
- Automatically assign a custom post to a custom taxonomy based on custom field value
- Exclude Custom Post Type & Pages From Auto-Tag Function
- How to stop subdirectory wordpress install adding head elemets to entire site?
- Listing taxonomies from custom post type
- Rendering Custom Post Types independently of the theme in use
- Sort by two dates. Default entry date and custom field if present
- Issue to get wp_get_attachment_image with cmb2
- Apply post formats to a specific post type only?
- Made Custom Post Types, but single.php not working
- Remove custom post type slug
- How do I get Link for Oldest Custom Post Type (dynamically)
- How to: Display ACF [fields] on Custom Post Types Utilising WordPress ‘Hooks’? [closed]
- Shortcode for display posts in wp-editor
- Previous/Next Link by Meta Value in CPT
- Restrict custom post type from appearing with ?post_types=
- Is there a way to have custom post type and page with the same slug?
- WordPress posts page for customer filtering and sorting along with category filter
- Added Custom Post Type and the View Option Doesn’t Work
- how to post default thumbnail if post not created yet
- Show data from one Custom Post Type in another Custom Post Type
- Option page’s form doesn’t work
- Add arguments to get_the_terms for custom post types
- Creating Sections for Post Types
- Returning a custom content types with meta values
- Strange custom post type issue
- Add custom field to admin area witthout using a metabox
- Can I assign a theme to a custom post type?
- CPT defaults to single.php?
- How to display wp_post by custom field value?
- Top level menu position overwrites another entry
- Enqueueing TinyMCE
- Get A Custom Field From A Custom Taxonomy Of A Custom Post Type [closed]
- Searching post types
- Associate Posts with individual user – hide from other members
- CPT to installable Plugin
- wp_query not returning my custom post
- Using page title as a link to term archive
- Getting subpage of subpage – Custom posts
- Should i use custom post type for a custom footer?
- best way to use custom taxonomy, post type and meta in a job system
- Virtual page and loading template
- Create/populate Custom Posts ACF fields from external JSON file
- Error 404 change permalink term custom term taxonomy
- Restrict admin pages for specific user role
- Custom attachment function not working in v5.4.2?
- Help understand and create a loop with WP_query
- PHP Warning with Custom Fields
- Don’t share custom taxonomy terms if applied to multiple Custom Post Types
- How to show custom post count in archive page
- How to add independent “Tags” to Custom Post Type?
- Instructor can view, edit, delete only theirs courses
- Custom status and permalinks don’t work?
- filter rest api post by a acf filed
- WordPress custom post type and page
- Highlight a Post on archive page if it has a new comment?
- Remove parent slugs from URLs on three customs posts types
- Custom post URLs
- I want to show specific parent terms child term with post list
- pre_get_posts not firing at all
- Not Able to Display Metabox Saved Checkbox and Selected option After Save/ Update
- How to use wp query posts with current post meta value in text widget
- Why are my wp urls showing page not found?
- Copying custom field value in to title
- Custom posts and custom taxonomies for many products and categories?
- How to retreive terms associated with a custom post type?
- Using tax_query to get single post per category
- Create taxonomy from Custom Post Type
- img src not working correctly in custom post type
- How to “Custom Post Type” as a non-programmer?
- Is there a function that replace category name with a icon?