You could put all the html in a variable and return it
$r = "<div id=\"" . $s['id'] . "\"...";
if (!empty($s['fb'])) {
$r .= "<a href=\" . $s['fb'] . "...";
}
$r .= "title=\"Follow Us On Facebook\" ";
$r .= "target=\"_blank\" ";
return $r;
But every shortcode on your site should do this, for them to appear in the right order. As soon as one starts echoing things, it could mess up the order.
Related Posts:
- Solution to render Shortcodes in Admin Editor
- Include PHP file in Content using [shortcode]
- Shortcode producing headers already sent error
- Enabling shortcodes for custom fields
- How to use get_media_embedded_in_content function
- Shortcode with parameters inside parameters
- Changing a function in function.php to a shortcode – for listing categories of only a certain post type
- how to create shortcode in wordpress
- What is wrong with this Shortcode? I get it in a wrong place inside the content
- Display random text from a file with the WP built-in AJAX API
- Set first oembed in post to a global variable or function
- Formatting post content to exclude gallery
- Remove images from get_the_excerpt
- Problem with extract() with custom shortcode
- Using locate-template & shortcodes doesn’t appear to work
- Displaying a random user with a shortcode
- Adding body class when post contains a specific shortcode
- Function to show only first instance of shortcode
- creating shortcode to pull json array
- Pass Shortcode Attribute to footer Script
- Detect Safari desktop browser and include the detection in a shortcode
- My simple custom shortcode is not longer working (possibly due to upgrade to WordPress 4.4 ?)
- Display gallery on top before content
- List child pages of specific page using shortcode
- Display first name of logged in user?
- WordPress shortcode attributes for database SELECT?
- create shortcode to list users with specific meta key value
- Variable if post is sticky in functions.php
- Shortcode inserts paragraphs before and after executing shortcode
- How can I make a widget shortcode to control all the widgets?
- Custom shortcodes not inserting into visual composer columns
- Create a custom taxonomy that will be used to create and filter markers in a Google Map
- Setting youtube size in functions.php
- Adding a colorbutton in tinymce dialog with current api
- Passing variable as add_shortcode argument
- Add button to kitchen sink toggle
- Excerpts are not displayed by a shortcode on category pages
- shortcode help require
- Optimizing a WordPress site
- Help With Creating Shortcode
- Shortcode parse error – wrong syntax
- wp_nonce_field is breaking form for reasons unknown
- Visual Composer creating own shortcodes with vc_map() to return simple Image
- Using multiple line variable inside a function?
- Testing for a shortcode using a function. 404 page throwing PHP Notice
- Echoing function into WordPress NextGen gallery
- Output loop to function return?
- How to echo the value of an array element using a function via a shortcode
- Wp-query Order By problem
- How to parse a shortcode within a shortcode?
- Variables not showing in short code
- Woocommerce checkout field
- How to include any template using Shortcode fuction?
- How can I pass a shortcode value to the head in wordpress functions.php
- Native gallery custom html output
- Need to convert image url to a Base_64 data url with wordpress function..
- dynamic site link for future migration in echo do_shortcode()
- Shortcode question
- Shortcode to get featured image of specific id post
- Modify shortcode to work with custom post types
- shorthand syntax for custom fields
- Shortcode of a function
- show all the posts thumbnails
- How to add a shortcode to call a function
- How can I call a PHP function inside a hardcoded shortcode?
- Is it possible to create a shortcode to link to a specific post/page where the tag is just an attribute?
- Display a list of random terms from custom taxonomy with shortcode
- Load templates, pass arguments, and render output from functions.php
- How to add if statement on WordPress shortcode output
- Passing function arguments via a shortcode
- Pagination not working – FrontPage
- Customizing the wp_video_shortcode output with add_filter
- Probleme shortcode with list author
- Function to function shortcode help [closed]
- I want to display the sku in the product pages of my EDD website
- Shortcode to output category description by passing ID
- Help using ShortCodes to style whole chunks of the post
- Shortcode to insert default text and change one word throughout it?
- use add_action in a shortcode (gravity form – WordPress)
- Shortcode Initialization in a Custom Theme
- Shortcode with pagination advancing multiple queries
- Show users last read posts for each user?
- Get shortcode attribute value to another function
- How to retrieve image IDs from shortcode content?
- Hide disclaimer from summary excerpts
- Function not receiving string from shortcode
- Shortcode to eliminate and replace with
- Problem in outputting shortcode
- Problem in shortcode outputting content
- Pull random comment from specific post, display on homepage with shortcode
- Set thumbnail from URL, by grabbing image in functions.php
- Shortcode to output get_header not working
- using enqueue_script in a shortcode isn’t working
- Gallery Shortcode Function Help
- Echo custom field value in shortcode function
- Shortcodes not outputting in correct divs
- trouble with passing class method data to outside function
- Get term count on a category page
- How do grab the main loop, with conditions, and output via shortcodes
- PHP error in shortcode [closed]