Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8623283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:14:42+00:00 2026-06-12T07:14:42+00:00

I have a shortcode inside a plugin I wrote. The shortcode always prints on

  • 0

I have a shortcode inside a plugin I wrote. The shortcode always prints on top, after a bit of research I found that I have to ‘return’ instead of ‘echo’ for me to get it in the right place.

I have inline HTML , css , javascript in various script tags inside the PHP file. Is there a way I can get it work without trying to return all the inline HTML. (adding ‘return’ to all html tags is a huge endeavour) ?

I know that a question on shortcode printing on top has been asked but this is not entirely the same problem I am having.

Appreciate your answers.

Just for people to get an idea of the code I am dealing with: This is just a small chunk of the code, but there is html, css spread all over the place.

extract(shortcode_atts(array(
    'id'=>'0', 'key'=>'0'), $atts));


if(substr($id, -3) == "***") $id = substr($id, 0, 8);
$id_licenses = getDbInfo($id);

$id_desc = array();
if(is_array($id_licenses)) $id_desc = $id_licenses;
else $id_desc[0] = $id_licenses;

if(isset($_POST['desc'])) {     
    $info = $_POST['desc'];

    $ids = getDbInfoByDesc($info);
}




?>

<style type="text/css">
label.inputlabel
{
width: 8em;
float: left;
text-align: left;
margin-right: 0.5em;
display: block; 
padding-left: 0.5em;

font-family: Tahoma;
  }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T07:14:43+00:00Added an answer on June 12, 2026 at 7:14 am

    You have to return the final result but if you want you can buffer the result and echo anything inside the buffer then can retun the buffered data, i.e.

    function yourShortCodeFunction(){
        ob_start();
        echo "Hello"; // this will not print out
        // more code
        $result = ob_get_contents(); // get everything in to $result variable
        ob_end_clean();
        return $result;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a wordpress theme that has a build in shortcode for creating an
I have in a sidebar: <div id=yyy> [shortcode]</div> It outputs a title that when
I have a wordpress shortcode which contains some other shortcodes inside it. When the
I have a function that replaces my shortcode with some content e.g. function output()
I have a table that has the following 3 columns, ID, ShortCode, UploadDate. I
I have activated TDO Mini Forms plugin and using the shortcode in my template
I have an Expand/ Collapse plugin which, via a shortcode, can expand/ collapse content.
I have plugin by WPMU that creates a membership system for your wordpress theme.
I have to following problem, after running script below it prints out an extra
I have created a shortcode in my functions.php which is designed to return the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.