Because “Standard” is not a format itself – it simply implies that the post has no formats.
…which is somewhat deceptive, given it’s listed in the Format meta-box as a format to choose
I think “standard” quite clearly implies what it means. If you’re creating a site in which a post is never “standard”, then fallback to a default:
if ( ! $format = get_post_format() )
$format="gallery";
Alternatively, hook onto wp_insert_post
and enforce a format if one has not already been set.
function wpse_58121_set_default_format( $post_id ) {
if ( ! get_post_format( $post_id ) )
set_post_format( $post_id, 'gallery' );
}
Related Posts:
- Password-protect a custom rss feed
- Is it possible to place custom post type files inside a folder in theme directory?
- Get term name and term parent into custom post type permalink
- Specify a particular page to list all custom types
- Template Hierarchy for custom post type pages
- Should Custom post types and fields be in the theme files or in a custom plugin packed into the theme?
- Methods for development wordpress themes [closed]
- Custom Post Type – Main page for certain posts
- erase post excerpt limitation [×]
- Query custom post type and showing its content
- Create custom post order (with custom post type meta)
- Change position of Post Formats box?
- How to manage wordpress knowledge base/wiki/posts collections
- REQUIRED: The theme uses the register_post_type() function, which is plugin-territory
- Change permalinks for posts but not for custom post types
- Assign single template to multiple custom post types?
- How to build a complex page structure
- How can I fix those issues generated by the Themecheck plugin
- How to override parent theme function through the child theme [closed]
- Template tags to display custom post type posts in category template?
- Custom Search form not working in localhost
- Group search results by post type, but hide post types with no results
- single-type.php not working, delivering 404
- Multiple Content Block
- Message on Custom Posts Type admin page
- How do I create an archive page for standard posts?
- Limit users by custom taxonomy and user roles
- Remove parent from custom post type
- need advice on how to do a lists using custom post types – taxonomy vs postmeta
- How to add extra input fields to CPT’s comment form?
- Pre_get_posts filter overwrites all search functionality
- How to Get Current Custom Post Type Selected Taxonomy Term (Not All Terms)
- Displaying a custom post types custom taxonomy value?
- Should I use custom menu, C.P.T. or theme options, or something else for this?
- What template files do I need to customise custom-category-term-links rather than fall back on archive.php?
- Allow non-logged in users to see a future post after clicking on a list of future posts
- Query & Order posts by custom fields
- custom taxonamy and post type
- Not Able to Get Custom Post Type Gallery Images URL
- How to Upload CSV Data into Custom Post Type Data with Metabox programmatically
- Building a Treatments Page, What Do I Use?
- Migrating a taxonomy’s tags to the native category
- Adding custom image sizes and post types to a plugin or to a theme?
- How do I set a custom page template for a custom post type?
- How to specify a template for a path like http://example.com/something?
- Unable to set featured image
- Display custom post using ID
- uploading problem of wordpress theme
- Two column layout with alphabetical ordering
- Custom post type permalink sends to 404.php
- Api rest_route 404 while building filter for custom posts (filtered by multiple meta keys / custom fields)
- how to get this tax_query working?
- why post_class() function apply css classes to all other files?
- Custom post type’s posts are not showing anywere but in xml sitemap
- Create a simple Testimonial page
- Assign a template to a custom post type when displayed by the main loop on the home page
- One Site. One Theme. Multiple Stylesheets without plugins?
- Custom Post Type – Portfolio no longer works
- If Post type use sidebar (‘tree’)
- Having Issue on Getting Metabox Checkbox Value
- Custom meta box in custom post type not working
- Make Next and Previous on single-$posttype.php use the same order as archive-$posttype.php
- Custom post type posts wont show in wp_nav_menu()
- How can I tell if I’m on a custom post type archive page?
- Front end create custom post types
- How to Enable Ascending or Descending In WordPress Default Built-in Loop
- How to display posts from a certain category in a bootstrap 5 carousel loop with multiple items?
- Invalid content when I try to import custom post type from the old template wordpress
- How to get the custom post data using post id in WordPress?
- Loop all post on single.php
- How can I make reusable post types with complex custom field structures?
- Custom post type 404 category page
- programmatically generated custom post type is created more than once
- How to use posts as tabs in a custom page?
- Problem with multi checkboxes value in metabox?
- Create dynamic logo carousel without using any plugin
- call a function when insert and update a custom post type
- Why get_posts() returns empty array while I am trying to get posts from some specific taxonomies and work properly with others?
- Change Background Color For CPT Template
- WordPress add taxonomies/terms list as a menu in archive page
- How To Display Category list from Portfolio post type plugin?
- Adding CPT changes entire layout of my site except for the archive of that CPT
- getting a blank login page :( any way I can fix this without having to do a clean install?
- Search form to find custom meta box generated data
- How to get $post object available inside functions.php to localize script?
- How to Display CPT Posts on index Page
- Issue on Counting CPT’s Under Taxonomy Term
- Function that get ACF fields value before saving
- Why is my custom form saving with ‘autodraft’ as title and slug?
- Author profile comments system
- Problems with a custom meta_box
- Custom post type and custom taxonomy archive inaccessible
- Query by post type or category
- Apply custom names for generic custom taxonomy name?
- Category names on CPT archive pages [closed]
- Single page for Custom Post Type not found
- How to create custom page templates with default page layout framework?
- Can you programme the selected page template to display block patterns automatically?
- how to display custom taxonomies in front page
- How can I produce multiple webpages with a different output based on one entry/Page/custom Page?