There is no “default” post format type, though internally in core, a post that has no post format assigned is usually referred to as standard. So, your first conditional will return false
using post-format-normal
because there is no such post format – but would still return false using post-format-standard
.
You could reverse the conditional, and check for gallery post format first. Note that you could use either 'gallery' == get_post_format()
or has_post_format( 'post-format-gallery' )
. (Personally, I find get_post_format()
to be a bit more intuitive.)
In any case, you would reverse the conditional like so:
if ( has_post_format( 'post-format-gallery' ) ) {
flexslider('index-post-image');
} else {
// Fallback output here
}
Note that you also have syntax errors in your code, such as nested PHP tags.
Related Posts:
- Only get_posts of certain post formats
- static variable loop not working in WordPress
- Show content if parent page has children
- Current post’s author name in the author meta tag
- Conditional statement for parent, child and grandchild pages
- Trying to use Ternary operators with WP Conditionals
- How does WP detect format type (and can I make use of this)?
- When is is_admin() available?
- Check if current page is wp-admin
- Second Navigation inside header
- Using is_page() in functions.php not working at all
- Output 2 items within the Loop
- conditional statement for custom taxonomy
- How to enqueue CSS and JS only on specific template?
- How to filter posts by post format “standard” from wp-json api?
- Get first URL from post content
- how could I load a different template part by page
- How do I use this PHP library to access OpenGraph data in a child theme?
- WordPress add post format support not working
- trigger html cleanup for all posts
- WordPress, AJAX and pre_get_posts using conditional tags
- If tag equals then show else show
- Conditional statement for dates
- How can I display a div ONLY if it is not a certain term page
- Don’t show certain div on front page?
- If ‘editor’ is empty, then
- Add class to DIV depending on page loaded
- Almost Done… Post Format Code
- How to: Conditionally Enqueue JS and Stylesheets, for Custom Post Type (Single and Archive Templates)
- Undefined index for default custom theme option
- Remove conditional tag from header
- Display an image based on field value
- Multidimensional Array
- Display the video of a post_format Video
- “if parent category is” conditional?
- Wrap posts p tags in div
- conditional: if is page, and all subpages
- Woocommerce getting top level category parent and make all sub categories have the same template and menu
- page 1 is not paged
- How to add Text before my Custom Term and hide it when empty
- How can i create a function tag in my plugin
- Add code to the header of posts by particular author
- Display specific page if user signed in
- How to get Post sidebar & footer including html like get_the_content() which only gets content section?
- Widget Logic – display on page and all child
- Need to adjust condition to say if I’m pulling categories from a post, to pull only the first one
- Setting ‘post_format’
- if user is admin display admin link and logout link else display logout only
- Add code only for blog posts
- How to define Og Meta Tags in header using conditions [duplicate]
- If Month=Particular month display content [closed]
- How can I add WordPress Audio Player as featured audio in Audio Blog Posts?
- How to echo a different field if another field is empty?
- Adding else if conditional statement to purchased theme
- Custom single.php files for different post formats
- Conditional in foreach loop is outputting content twice
- Advanced custom fields Repeater conditional statement not working [closed]
- Load slideshow.css file only if Slideshow is checked / on
- Issues trying to add a href statment with PHP into a PHP Echo Statement [closed]
- if is specific custom post in cpt
- advanced custom fields: repeater field within conditional statement [closed]
- WordPress Block Editor Gutenberg running code inside ! is_admin()
- What do ++ and *+ mean?
- How to add date range in woocommerce with code
- How can I modify the permalink via a filter?
- How can merge two arrays values in one array and save in database
- Create a post variable processing page
- How Do I Add User Custom Field to REST API Response?
- Bare minimum to include in PHP file to use WP functions? [duplicate]
- Should I store my Facebook access tokens?
- How to return output of the new wp gallery block for automatically Link images To Media file
- Can an array be used as a meta_query value?
- Filter get_the_title to remove certain characters?
- Image as Sales Badge
- How to Arrange PHP Files to Allow for Multiple Types of Pages?
- Limit Widgets to Sidebar ID’s
- Add / Update Custom Fields After Select Pictures in Media Window
- How to debug this search & replace strings snippet?
- Can’t retrieve element with WordPress default @fetch_rss();
- Call WC_Product get_price()?
- How to remove the space before the ellipsis in excerpt?
- Website completely messes up when logging out
- How do I include an external PHP file in a subdir WordPress install?
- Need to remove ‘Featured’, ‘Date’ and ‘Comments’ from WordPress Sticky Post?
- Convert all uploaded PNG files to PNG-8 format
- How to set all External Domain Links with nofollow Attribute from Header Footer Content and Excerpt using PHP?
- WordPress Post Block Element not properly parsed with the_content filter
- How to display only specific Error types in debug.log? No notices, warnings, etc
- WP + MySql db / PHP
- random woocommerce categories are not showing when count enabled?
- Submit to itself don’t work
- WooCommerce – Add product category below product price [closed]
- Font rendering problem after using include in functions file
- Can someone help me edit the code for limiting image dimensions
- Access preview settings in php
- custom field meta-box with dropdown/autocomplete
- Submenu opened problem
- ACF | WooCommerce | Theme Development | How to include a /template-part/ that makes use of ACF’s on a custom WooCommerce homepage?
- append special url end of my website urls
- How to conditionally concatenate and translate two very long strings?