WordPress.org

Ready to get started?Download WordPress

Forums

Widgets on Pages
[resolved] Adding widget shortcode to php file (12 posts)

  1. jnorton1089
    Member
    Posted 1 year ago #

    Todd - you had helped me set up the alignment for your widget on my previous question, so I was thinking you might be able to help me with this question as well?

    So here is my new page with your plugin looking the way I wanted it to...
    http://www.newlifebiblestudies.org/unlearnedandignorantmen/

    What I'm wondering is, is there a way to get this same sidebar to show up in my category page? Here is an example category page...
    http://www.newlifebiblestudies.org/category/unlearned/proverbs/

    Basically, I want the same look and feel as the other page. I am assuming there is a way to add the shortcode for your widget into my archives.php file? If not no big deal, I was just hoping to keep the site consistent if I could. Thanks in advance for all your help!

    Jake

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

  2. jnorton1089
    Member
    Posted 1 year ago #

    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!

  3. toddhalfpenny
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  4. jnorton1089
    Member
    Posted 1 year ago #

    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?

  5. toddhalfpenny
    Member
    Plugin Author

    Posted 1 year ago #

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

  6. jnorton1089
    Member
    Posted 1 year ago #

    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?

  7. jnorton1089
    Member
    Posted 1 year ago #

    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

  8. jnorton1089
    Member
    Posted 1 year ago #

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

    Jake

  9. toddhalfpenny
    Member
    Plugin Author

    Posted 1 year ago #

    Great news, Jake... nice work.

  10. jnorton1089
    Member
    Posted 1 year ago #

    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/

  11. toddhalfpenny
    Member
    Plugin Author

    Posted 1 year ago #

    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

  12. jnorton1089
    Member
    Posted 1 year ago #

    Thanks very much!!!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.