Here is the correct shortcode function
function section_shortcode_func( $atts, $content = null ){
$atts = shortcode_atts( array( 'bgimage' => '' ), $atts);
$bgimage = isset( $atts['bgimage'] ) ? $atts['bgimage'] : '';
ob_start();
echo "<div class="section" style="background-image: url($bgimage)">";
return ob_get_clean();
}
Now you can call it this way
[section bgimage="xxx.xxx/wp-content/uploads/2017/10/xxx.jpg"]
Related Posts:
- apply_filters(‘the_content’, $content) vs do_shortcode($content)
- How to get shortcode’s input values inside a filter?
- Filter specific shortcode output?
- Insert Custom HTML After Shortcode
- Is there a way to add another row to the tinyMCE kitchen sink toggle?
- add_filter and changing output captions of image gallery
- How to add attribute to output with wp_video_shortcode add_filter
- Search content for shortcodes and get parameters
- Change default settings used by gallery shortcode
- Shortcodes not resolved in AJAX call response
- Ajax, filters and shortcodes
- Format content value from DB outside of WordPress filters
- Use content custom filter for all shortcodes
- How to link current user to their author page through shortcodes
- filter title from shortcode
- how to remove filter from wordpress shortcode output
- Error when overriding only some audio shortcode HTML output
- How to use shortcode attribute in separate function
- Shortcodes — Using add_action, add_filter in the shortcode
- How to pass variables to custom filter from multiple functions
- How to filter backend post list showing only posts having a shortcode
- How can I return shortcode output to the top of the content?
- the_excerpt filter doesn’t work as expected
- run shortcode in excerpt of single custom post type
- Filter everything from content except output of a shortcode
- Something is filtering my shortcodes… Can’t figure out what
- How to use do_shortcode_tag to modify the output of a shortcode?
- Shortcodes within the sidebar text/html widget: How to preserve the raw HTML output of the shortcode?
- How to change dynamically page title according to variable data?
- How can I filter tag_description()?
- How to remove shortcode(s) from WYSIWYG Page editor for Non Admins
- Shortcode / plugin with custom (flexible) output
- Filter Shortcodes when using get_page
- Parse a shortcode differently based on on what it’s nested in
- Need to return shortcode text instead of the output
- add_filter to the_content after apply_filters
- post_orderby filter breaks function
- the_content getting current page content instead specified ID
- Override wordpress audio playlist
- How to wrap pattern-matches from the_content in [wiki]-shortcode tags
- Add Index to Item in WordPress Gallery
- create a shortcode with acf including a filter
- How to take shortcode and content separately from a page?
- Auto-generated excerpt with shortcode and read more button/text link
- shortcode function outputs multiple anchor tags
- apply_filters to $GLOBALS
- Change shortcode output (filter?)
- Is it possible to include the add_filter() function within a shortcode function
- Activate short codes for all post queries?
- Problem with shortcodes in external file
- How can I display wp_link_pages before a shortcode, if it is used, or display after content?
- Modify links when inserted by WYSIWYG editor
- post_mime_types Filter not Working in List Mode
- Include a page template along with add_theme_support()
- post_row_actions filter is not working while update post using quick edit
- Taxonomy Custom Column – ‘manage_{TAXONOMY}_custom_column’ filter only passing 2 arguments
- How to get list of all hooks of current theme / plugin?
- get_query stops working after post filter
- Can you use add_filter() inside other function?
- is there a specific place where add_filter must be placed?
- add_filter() function misunderstanding
- How to make a widget expand wider than the column width when editing its settings in the admin
- Is there a wildcard/catchall filter hook?
- Apply the_content filter, but prevent other hooked actions
- Filter my args by the post 1st letter
- Adding Filter to Homepage only
- the_excerpt filter with an empty excerpt
- Add Defer Attributes to WordPress Scripts with consistent versioning
- Remove CSS & JS files from WordPress Main Page For Increase Pagespeed?
- In need of a content replace filter for posts in a specific wordpress category
- How to filter post content and force every link () made in blocks to return urldecode() with readable value?
- Link to Shop-Filter with .current-menu-item
- Remove posts inside pre_get_posts using a custom query
- Remove / Hide Attachment Display Settings in Add Media popup / dialog
- how to customize rss feed tags using hooks?
- How can I replace an oEmbed URL in post with actual embed HTML
- Replacing a deprecated filter ‘woocommerce_get_price’ with ‘woocommerce_product_get_price’
- How do you get specific tags from the_content?
- Add a filter inside an action init
- Using add_filter to prepend content, result is out of order
- Why is overwriting $GLOBALS killing the_content()?
- Sorting products by price ( regular + sale price )
- Rewrite rule and display of post
- Passing variable from child theme function to parent theme filter
- paginate_links() Change the order of links
- Add Filter – Pass Variable (PHP < 5.3)
- How to disable a wp filter in a certain admin panel page
- Why does admin_body_class not work?
- How to track a particular page in order to address the loading speed issue
- How to filter wp_get_recent_posts() to only posts that have thumbnails?
- How to check which submission button was clicked?
- remove_action conditionally for Custom Post Type – not working
- wp_get_attachment_link filter not working
- How would I remove an inline googleAPI font script in the the parent theme header.php?
- Getting entry ID from frm_email_message filter in formidable
- Is there a hook or filter that adds a button to the left of the search box?
- Background color and background image below element in Contact Form 7 – error tip [closed]
- Change password reqts with NO plugin without breaking resetpass link?
- How can I conditionally add the filter option_home?
- wc_get_template_part filter not working