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
- Allow non-logged in users to see a future post after clicking on a list of future posts
- Help need making decision. Ads rotating site on wordpress
- Query & Order posts by custom fields
- custom taxonamy and post type
- What is the recommended / best way to do this: Event calendar post/type in a block-based theme?
- Return the latest post from a custom Taxonomy and Post Type
- Don’t know how to show custom taxonomies from a custom post_type
- Not Able to Get Custom Post Type Gallery Images URL
- JS innerhtml changing style when using AJAX
- Display a grid of taxonomy terms at root taxonomy page
- How to Upload CSV Data into Custom Post Type Data with Metabox programmatically
- How to change the post type a theme shows by default?
- Get unique superset of taxonomy terms from a list of custom posts in another hierarchical taxonomy
- What is the best practice for displaying my plugin content in themes?
- Event Custom Post Type Title show by upcoming Event Dates
- How to have this permalink structure: post_type/postname/custom_inner_page
- Building a Treatments Page, What Do I Use?
- Custom post types and category archive
- Migrating a taxonomy’s tags to the native category
- Adding custom image sizes and post types to a plugin or to a theme?
- custom comments form for custom post type
- How to produce a sub-page-system in WordPress
- Want to be able to sign up subscribers as authors
- How do I set a custom page template for a custom post type?
- WebP Fallback for Inline Background Image in Style Attribute
- How to specify a template for a path like http://example.com/something?
- Warning: Invalid argument supplied for foreach() [closed]
- Custom post type isn’t working
- Warning: Invalid argument supplied for foreach() in post.php [closed]
- Unable to set featured image
- How can i link a custom post type thumbnail to intermediate size
- i cant see the max_num_pages of a custom wp query
- Archieve.php not loading for custom post type
- Getting Un Wanted Gallery Shortcode In The Page on Loop
- detect your custom post type in WordPress
- Display custom post using ID
- Custom WP_Query doesn’t display all posts
- Running a song lyrics site on WordPress
- Using page slug in wp_query
- WordPress app page not found error for posts with hyphen in permalink
- Where is the sticky post option?
- uploading problem of wordpress theme
- How to have permalink like domain.com/term/postname?
- Page Template Dropdown For Custom Post Types
- Two column layout with alphabetical ordering
- Custom post types problem
- Create a comments template for custom post types
- Custom post type permalink sends to 404.php
- WP_Query with custom post type ID
- 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?
- Show Taxonomies with admin area for custom post type?
- Pagination doesnt work in custom post type
- Archive links for custom post types
- Include custom post type custom taxonomies in Categories widget
- Custom post type’s posts are not showing anywere but in xml sitemap
- How to Use Custom Meta Field Instead of CPT Title in Post URL
- Custom post type is using the index.php template
- Create a simple Testimonial page
- Assign a template to a custom post type when displayed by the main loop on the home page
- Custom Post type content within a slider
- One Site. One Theme. Multiple Stylesheets without plugins?
- Custom Post Type – Portfolio no longer works
- If Post type use sidebar (‘tree’)
- Render a Post or Page using the correct file
- Can I assign a theme to a custom post type?
- Custom Post Type – after disable ‘Add New’, I can’t edit and delete post
- Having Issue on Getting Metabox Checkbox Value
- Searching post types
- Custom meta box in custom post type not working
- Add admin script to several post types
- Why does my URL keep returning 404 error code?
- Make Next and Previous on single-$posttype.php use the same order as archive-$posttype.php
- display two images in theme header.php file
- Custom post type posts wont show in wp_nav_menu()
- How to exclude categories from a sidebar with active widgets in it?
- How can I tell if I’m on a custom post type archive page?
- How does one go about converting custom post type to post format?
- How to display magic field’s custom write panel in wordpress theme?
- Creating an option for writing a post without an author attribution for a group blog on WordPress
- Front end create custom post types
- WordPress giving me the index
- Not Able to Add New Class To CPT Attachment Image
- How to Enable Ascending or Descending In WordPress Default Built-in Loop
- Custom post category name showing empty