WordPress.org

Ready to get started?Download WordPress

Forums

Widgets on Pages
[resolved] Template tag feature not working? (12 posts)

  1. dains
    Member
    Posted 2 years ago #

    Hi, I've used Widgets on Pages for the template tag feature in the past and found it very valuable for themeing. I don't have that past work available as a check, but I'm finding that the template tag feature doesn't seem to work now. I've upgraded to 3.2.1 on my development sites and have some testing results for you.

    Here's the output I get from a text widget inserted using WTP's template tag call 'widgets_on_template("wop_5");' :

    [Code moderated as per the Forum Rules. Please use the pastebin]

    I've tried both the default markup of "wop_#" and swapping double quotes for single quotes 'wop_#' and neither way seems to work.

    Any help would be appreciated!

    David

    http://wordpress.org/extend/plugins/widgets-on-pages/

  2. dgitaly
    Member
    Posted 2 years ago #

    Ciao David,
    you must replace "wop_1" with the name of your WoP.

    If your WoP is 5 the template tag will be:
    <?php widgets_on_template('5'); ?>

    It worked out for me!

    Dina

  3. toddhalfpenny
    Member
    Plugin Author

    Posted 2 years ago #

    dgitaky is correct... so if you haven't set any specific names and you want to access the third sidebar up you're probably going to need something like

    <?php widgets_on_template("Widgets on Pages 3"); ?>

  4. dains
    Member
    Posted 2 years ago #

    Whoops, was I misinterpreting the instructions here?

    #5 on http://wordpress.org/extend/plugins/widgets-on-pages/installation/ says use "php widgets_on_template("wop_1");". I assumed that meant use "wop_+the number of the WOP widget", which is 5 in my case.

    So it will work with just the number then, or with the specific name, and passed as a string either way. I can deal with that. Thanks for the help!

  5. dains
    Member
    Posted 2 years ago #

    Ok, still getting this output:

    http://pastebin.com/8vb5smkN

    It appears to be calling the right widget, but no output. The content is just a simple function to output something, and works fine when placed directly on the page. Any ideas?

  6. toddhalfpenny
    Member
    Plugin Author

    Posted 2 years ago #

    Erm... what widgets do you have in that sidebar?
    Can you try changing the template to call another of the sidebars?

  7. dains
    Member
    Posted 2 years ago #

    Hmm it seems that passing the number instead of the name is causing the problem. I tried the name and it worked fine in all cases, but number did not work either in template tag or shortcode.

    Do you see anything wrong with this?

    <?php
    widgets_on_template('4');
    ?>

    I'd really rather not use names because if they get changed, you have to change the code as well, whereas numbers are more-or-less static.

  8. toddhalfpenny
    Member
    Plugin Author

    Posted 2 years ago #

    Ha ha... do you know what I can't even remember if it accepts a numerical value.., it was such a long time ago that I coded it.

    I'll check the code and and post an update here.

  9. dains
    Member
    Posted 2 years ago #

    Thank you Todd! This is the ONLY plugin that gets rid of all that template and functions.php coding to put widgets in, so it's really good to see it's still supported. I wish it was core :)

  10. toddhalfpenny
    Member
    Plugin Author

    Posted 2 years ago #

    Hey dains,

    Seems that you have to use the name... and I also think this is the best way to do it... I mean if you name the sidebar then you should really use that as it's much more meaningful.

    Sorry if this doesn't match the way you want to use it.

    Todd

  11. dains
    Member
    Posted 2 years ago #

    Thanks Todd. You might want to update the instructions then, I was just following the directions.

  12. toddhalfpenny
    Member
    Plugin Author

    Posted 2 years ago #

    Ah really?

    Thanks for the spot... I'll get these updated.

    Ta,
    Todd

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic