try :
if (strpos($post->post_content,'[gallery') === false){
$gallery = 0;
}else{
$gallery = 1;
}
Related Posts:
- how to have the gallery shortcode output one single UL list instead of several DL?
- Automatically add this attribute to the gallery shortcode
- How do i link gallery thumbnails to different url’s using the wp native gallery?
- WordPress gallery ‘post_gallery’ filter doesn’t work with feeds?
- conditional shortcode not working
- Remove width and height attributes from [gallery] output
- Gallery shortcode menu order fix no longer working on WordPress 4.0
- conditional shortcode not working
- Some doubts about gallery shortcode in WordPress
- Should I cache default WordPress gallery shortcode output?
- Numbering Image List in Gallery
- Rewriting WordPress Gallery Shortcode with Bootstrap Carousel
- change wordpress gallery shortcode to slider
- Remove hyperlink on gallery shortcode
- Add custom setting that uses radio button to WP Gallery
- WordPress Gallery shortcode: Display one category ID only
- How to get gallery id inserted to a post?
- Check if post has gallery images/media
- How to Modify WordPress Default Image Gallery Shortcode
- Change WordPress Shortcode added in to post
- Gallery shortcode – change link file image size? (not using default fullsize image)
- add action only if gallery shortcode attribute is equal to?
- Unable to the get the gallery inserted between shortcodes
- Adding shortcode field to edit gallery / Gallery Settings
- How to change the output of gallery shortcode
- Replacement for gallery_shortcode function not taking all attributes
- How to Retrieve data of Gallery Shortcode and display it above a post
- How to copy [gallery] shortcode between posts using polylang [closed]
- Which file renders the “Edit Gallery” Settings page?
- How to display NextGEN gallery in templates?
- Use full size images in a specific gallery
- How to Enable embedding WordPress default gallery in comments?
- How to add new images to existing shortcode configuration?
- Gallery shortcode is empty but magically creates a gallery
- Can we add a single caption to the gallery shortcode?
- Automatically add class-attribute to gallery?
- Replace custom gallery shortcode with default gallery shortcode
- WordPress Gallery with ID’s Shortcode not Working
- Remove width and height attributes from [gallery] output
- Changing layout of defaul gallery output to masonry
- What makes a placeholder resizable in Tinymce?
- how to show last 5 images from the one post gallery
- Gallery Shortcode: using size=”full” doesn’t call the actual thumbnail image size
- Enqueue Scripts / Styles when shortcode is present
- Combining shortcode and get_template_part
- Escaping quotes from shortcode attributes
- Shortcode output always showing at top of page
- How to detect if a Shortcode is being called on a page?
- How to get current page title inside a page itself in a shortcode and in page content
- shortcode inside another shortcode
- Need MySQL Query or WP-CLI command to updates old URLs in Shortcodes [closed]
- Custom Shortcode AJAX 400 Bad Request
- shortcode to create dynamic dropdown box form shortcode attributes
- Can’t seem to get [shortcode]s to work
- Wraping $content into link with shortcodes
- nested Shortcode doesn’t work
- TinyMCE get selected text and underlying HTML
- other shortcodes in Contact form 7 MAILS [closed]
- Remove empty p-Tags in Shortcode content before non p-Tags
- Wrap shortcode inside custom block
- Creating a shortcode based on users preferences
- Get a post’s thumbnail url or display default image in shortcode
- basic shortcode – Why 1st paragraph not wrapped in p tag, but 2nd is
- unwanted P tags in shortcode, delay wpautop not working
- Convert HTML Script to Shortcode [closed]
- Registration Form Shortcode
- Include tags in the body of a post
- Remove shortcodes that are different (but same pattern) in each post
- Place a URL parameter value inside a WordPress short code
- Print shortcode in defined area
- WordPress shortcodes are not working
- Conditionally Loading JavaScript/CSS for Shortcodes
- Placing tags on wordpress visual editor using shortcodes
- how can i pass this attribute in this shortcode?
- How to add a same div on every page
- Display a form partially with a shortcode
- Modifying the wordpress login page and then referencing it with a shortcode problem
- Render shortcodes with get_post_custom
- Set redirect for need login
- make user_id in a shortcode dynamic based on who’s logged in
- Shortcode not working in CPT taxonomy
- wp_enqueue_scripts does not work on admin page
- shortcode containing other shortcodes not returning content
- To know whether insert shortcode in custom meta box
- Shortcode not being executed
- Load gravity form via ajax using do_shortcode
- Video Short Code and Media Fragments URI
- How to process a single attribute in a SQL request twice times?
- Customise standard lists within my shortcode
- How to fix transparency in product sliders / featured products on home page?
- How do I use “while” and “end while” inside of the echo do_shortcode with ACF Repeater?
- Problem in creating a shortcode form custom post type slider
- add php shortcode in return function
- style css to header for shortcodes
- What does this shortcode do?
- create shortcodes for posts
- How Do I create a shortcode to dispaly a go to top button on any page or post
- Executing a shortcode at the top of PAGE template?
- Custom shortcode with < in content
- add_action to only be called if uploading media from the front end