As Milo noticed, shortcodes should return
content instead of echo
ing it. So change
while($query1->have_posts()) : $query1->the_post();
echo '<div class="menu-thumb">';
the_post_thumbnail( );
echo '</div>';
echo '<div class="menu-title">';
the_title( );
echo '</div>';
echo '<div class="menu-content">';
the_content( );
echo '</div>';
endwhile;
to
while($query1->have_posts()) : $query1->the_post();
$div = '<div class="menu-thumb">';
$div .= get_the_post_thumbnail( );
$div .= '</div>';
$div .= '<div class="menu-title">';
$div .= get_the_title( );
$div .= '</div>';
$div .= '<div class="menu-content">';
$div .= get_the_content( );
$div .= '</div>';
return $div;
endwhile;
(replace echo
with return
and also anywhere there is a the_something()
replace it with get_the_something()
so that at the very end, it return
s the whole chunk of output.)
Related Posts:
- Javascript console errors and WSOD on edit post pages
- Can I add Short Code Of A Plugin In The Code Editor of WordPress?
- @wordpress/scripts advanced usage
- Thumbnail image doesn’t show up in Shortcode output
- Has blocks gutenberg block multiples registers type in my Plugin
- Fixed: Console.log twice in the edit function
- list of custom post by custom field in frontend
- insert og image link in wordpress post
- Possible way of having multiple Gutenberg instances for a page?
- get_post_meta shortcode returns empty field
- How to resolve warning for `unstableOnSplit` prop on a DOM element in block editor
- Get a value from a shortcode for another function
- How to dynamically add template in Innerblock?
- How do I use a plugin’s shortcode attribute value in another function?
- How to check if short code is present in template?
- Shortcode do not return the right data in post
- How to call function in WordPress on button click?
- Displaying different content depending on variable
- Why does my custom plugin only function correctly once per page?
- Hide content for specific users with id
- How to create a custom block in Gutenberg with multiple checkboxes?
- How to create algorithm for ordering posts in WordPress?
- WordPress Gutenberg How to make TextControl Required?
- Why is my shortcode not working?
- JS working when used normally but not in wordpress
- Make the product page as homepage WooCommerce
- Shortcode show error while editing post
- Image path in childs theme
- WordPress Shortcodes – Return $Variable
- Better search on WordPress.org Plugins?
- Get Shortcode output to database for static post_content
- Shortcode function not showing up on mobile browser
- Gutenberg Block: How to reload a ServerSideRender?
- shortcodes not working [dt_carousel & [dt_fancy_image
- using WPPB shortcodes without the plugin
- Issue Saving Posts That Contain Shortcode
- Using Shortcode Result In Custom HTML Block (Using Google Sheet JQuery Result As NumScroller data-max)
- Get Current Post ID in WP Loop For GiveWP
- How to change the width of certain paragraph or header blocks?
- save short-code in my custom plugin settings problem missed something
- How to pass multiple custom fields as shortcode’s parameters
- After Update Advanced Gutenberg Plugin – advgb/container site does not support block
- Implementing Scrollable Images
- How to use plugin’s shortcode in custom design? [closed]
- Block content rendering on the top just below body tag
- Looking for Image Slider that is based on default WP Media Library
- Gutenberg editor in WordPress 5.0.3 /wp-json/wp/v2/pages/4713/autosaves?_locale=user 500 (Internal Server Error)
- Shortcode generated widget to appear on same line as heading text and button
- Do_shortcode before send email content
- WordPress show descriptions under images in gallery
- Get shortcode attribute for AJAX call
- Page takes on two different formats
- WP Plugin CSS not being applied to page
- How to use a shortcode of a plugin in another plugin php file
- Bootstrap carousel – Using shortcode inside enclosing shortcode
- How to store multiple instances of the plugin’s options for various shortcodes
- Modify Plugin PHP Class in Child Theme – Correct Method
- Multiple Meta key in search
- Sanitize AROUND shortcode
- How to get custom setting from get_option and pass it in getEntityRecords in gutenberg block?
- Buffered output in chunks and shortcode – how do I achieve that?
- How can I add a zip code service availability checker in WordPress without Woocommerce? [closed]
- Shortcode cannot parse attributes within double quotes. ” is becoming ” breaking my shortcode
- Accessible ‘List Carousel’ block/pattern?
- Problem with a shortcode generating a error [closed]
- Vanilla javascript in custom gutenberg block not working
- WordPress custom block: Link saved in database not retrieved when editing post
- Display file contents within Plugin
- Implementing onSplit/onMerge in dynamic Gutenberg Custom Blocks
- Best approach to change mobile background image and adding its class
- Remove posts that start with similar words (like a delete duplicate posts plugin)
- Why is my Gutenberg block not saving and rendering the chessboard?
- How can we extent core/group or cover block?
- Force post update with React
- How do I edit text color for shortcode?
- Editing a block to add a button to have a drop cap
- Zip using “wp-scripts plugin-zip” with custom “build” folder and subfolders?
- If InnerBlocks.Content is empty?
- How to list latest 5 posts from each author from a custom CPT? I want to create a custom Gutenberg block
- correct way to enqueue js and css files for wordpress shortcode?
- Custom block padding control (via support) initialization
- WordPress custom block: How to treat each button as a separate block?
- Custom block based off core block using filter
- How to register a template in [NEW] WordPress site editor through a plugin
- How to display title, description etc in block images?
- Why is my drop down empty
- PHP Fatal error: Cannot redeclare distance() when making a new block
- WordPress Gutenberg Custom Block the viewScript does not get loaded on the frontend when my block is inserted
- How to get next day date of a specific day
- How to change the version of block.js and plugin to the same of Package.json?
- Custom Plugin not Displaying in the Website Production environment (Divi)
- Using Glide.js in custom Gutenberg block
- Can I add two wordpress shortcode plugins in the same site (not the same page)?
- I have to select text from gutenberg editor. Purpose is to store and replace text
- Struggling to edit the width of text in ‘Variations’ template
- How do I apply different block supports to different parts of my custom block?
- Prevent WordPress Link Editor from Automatically Adding “http://”
- Patterns are not displaying in Custom Gutenberg editor component to render gutenberg everywhere
- Spectra styles not loading when crating theme from scratch with Create Block Theme plugin
- Gutenberg: How can I disable backspace/delete key from removing a block