Support » Plugins » Hacks » Need help getting text above shortcode

  • I want to display my new zencart products in the sidebar of my my blog. I’ve tried using Sideboxes Anywhere (single_sidebox.php) from the zencart site, but for the life of me can’t get it to work in my blog sidebar. I’ve tried pasting code into the sidebar php file, and I’ve tried putting it into a php code widget without success.

    I found a plug-in called WordPress_ZenCart_Listing, although it doesn’t seem to be maintained. Although I get errors with the widgets, I can get the shortcode version to work. The problem is, any text that is above the shortcode, shows up below it–no matter if the shortcode is placed on a page, post, or sidebar widget. So for example, in a sidebar widget, the heading for it shows up underneath my zencart products instead of above.

    I found this thread that shows code that might fix it:

    function sample_shortcode() {
    include 'sample_shortcode.php';
    $result = ob_get_contents();
    return $result;
    add_shortcode('sample_shortcode', 'sample_shortcode');

    The person said “Put it in your plugin code and put the sample_shortcode.php in the same directory. (Best to put your plugin in its own folder inside plugin folder.”

    I don’t know what is meant buy the sample_shortcode.php
    Is this a file that I create? & What goes into it? Also, exactly where in my plugin code do I put the above code?

    Or, if someone has any suggestions on how to get zencart new products or featured products to show up in my sidebar, I’m all ears! Another person was successful using the zencart single_sidebox.php on her blog and tried to help me, but we couldn’t figure out why it wouldn’t work. I hired someone to help me, but their solution wasn’t good.

    I’m hesitant to use this plugin I found since it looks like their site isn’t being maintained, but I’m at a loss for what else to do.

  • The topic ‘Need help getting text above shortcode’ is closed to new replies.