WordPress.org

Support

Support » Plugins and Hacks » Widgets on Pages » [Resolved] Adding widget shortcode to php file

[Resolved] Adding widget shortcode to php file

Viewing 11 replies - 1 through 11 (of 11 total)
  • Also, I would only want to do this if I could keep it category specific (since we have three different blogs on this site that are being sorted out by three parent categories)… if you could let me know if that’s possible, I would appreciate it as well. Thanks!

    Plugin Author toddhalfpenny

    @toddhalfpenny

    Hey Jake,

    This could be done by using the Widget on Pages template tag. See step (5) of the installation instructions. As for making the categories specific this might need a tweak to the widget itself to becomes aware.

    Oh thanks I didn’t see that there in the installation! I was thinking something like this might work for the category specific part…

    if category = 2
    <?php widgets_on_template(“wop_1”); ?>
    end if

    I’m just not sure of the syntax I would need. Would something like that work?

    Plugin Author toddhalfpenny

    @toddhalfpenny

    Yes, that’s right… and you replace the “wop_1” with whatever the sidebar is called (as you would specify it in the shortcode).

    Ok, so I was trying to at least get it to work without categorizing it first, and it adds the sidebar correctly based on the css but it doesn’t actually include the content that is supposed to be there. See example here – http://www.newlifebiblestudies.org/category/unlearned/proverbs/

    This is the code I used… which implements the shortcode I use in my page here – http://www.newlifebiblestudies.org/unlearnedandignorantmen/.

    <?php widgets_on_template(“widgets_on_pages”); ?>

    Do you see anything else I’m missing?

    So I have the category specific part working, all I need left is to figure out why the widget content is not displaying. Plese let me know if you see anything. Here is what I’m using in my archives.php file.

    <?php if (in_category(‘2’)) : ?>
    <?php widgets_on_template(“widgets_on_pages”); ?>
    <?php endif; ?>

    I appreciate all your help. Thanks,

    Jake

    Never mind, I got it all figured out! Thanks very much,

    Jake

    Plugin Author toddhalfpenny

    @toddhalfpenny

    Great news, Jake… nice work.

    Thanks! I’m sorry I do have one more related question, then I should be done. Do you happen to know what CSS I would use to get the widget sidebar to scroll all the way down to the comment box on my post pages? See this link to see what it is currently doing.

    http://www.newlifebiblestudies.org/unlearned/2013/01/02/sentence-21-proverbs-210/

    Plugin Author toddhalfpenny

    @toddhalfpenny

    Hey Jake,

    To do this you could do something like the following;

    .one-column section { float: right; width 70%;}

    You’d be best then to make the widgets on pages width also a % value so it would scale to match (I think your theme is responsive so this would be needed).

    Obviously play with the values as you see fit.

    The above would also shift the comment box so not sure that’s exactly what you’re after… but you could maybe target the float left with .excerpt4 perhaps?

    Ta,
    Todd

    Thanks very much!!!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘[Resolved] Adding widget shortcode to php file’ is closed to new replies.
Skip to toolbar