• Resolved philtyler

    (@philtyler)


    Hi everyone.
    I’ve done some searching and a few posts have came close, some went back and forth, but I’m still looking for a simple walk through of how to use widgets somewhere else on the site/blog but NOT in the sidebar.

    I would like to set up a new page on my site…lets call it philtyler.info/siteinfo and on this page have widgets like- most popular posts, most commented, twitter etc. Things that would normally be in my sidebar if I didn’t have ads running.

    I won’t feel bad if this is discussed somewhere else. Please post the link to it.
    Thanks everyone!

Viewing 4 replies - 16 through 19 (of 19 total)
  • Hi Phil, I hope you’re doing well. Since you didn’t get back to me I’m assuming you must have a lot going on, so instead of waiting for your answer, I’ll just post my findings so you can adjust them to your specific needs (I’m assuming you have the latest WP version installed, 2.92).
    Basically, what you have to do consists of three main steps:
    1. Adding a second sidebar in your functions.php;
    2. Creating a custom page template for your “siteinfo” page and calling a second sidebar inside that template to display your custom widgets, which is what Esmi had suggested originally.
    3. Create your “siteinfo” page and assign it the custom page template you created.
    –> By doing so, you will have two sidebars in your Appearance/Widget panel to which you can add the widgets you desire individually, and then have those displayed in your “siteinfo” page.

    1. Adding a second sidebar in your functions.php
    You can follow this pretty straight-forward Tutorial, which tells you what piece of code you have to change in functions.php and how to call the generated sidebars anywhere on your template. Please note that you will have to adjust the parts of the code that control the ‘before widget/title’ and ‘after widget/title’ lines to fit your specific template or needs.

    2. Creating a custom page template
    For this part, you should take a look at the link esmi posted earlier. What you can do to make this step easier, is create a copy of your pages.php file and give it a different name (it could be “siteinfo.php” or “custom_page.php”). Then, you would just have to assign it a Template name by inserting this code at the top:

    <?php
    /*
    Template Name: siteinfo
    */
    ?>

    and also call the second sidebar (i.e., the one you will be using to display your custom widgets in the siteinfo page) with the piece of code provided in the link in step 1 (just insert it in the section of the page you want the widgets to appear):

    <?php if ( !function_exists('dynamic_sidebar')
    || !dynamic_sidebar('sidebar2') ) : ?>
    <?php endif; ?>

    3. Create your “siteinfo” page
    After creating the custom page template, you can use it as the structure of your “siteinfo” page. You just need to create a new page in your WP admin “Pages” submenu, write or insert all the content you wish, and in that same window, select the “siteinfo” Template under the Attributes/Template section (it’s a scroll-down menu on the right side of the window).
    In order to control which widgets you would like to display in that page, just go to your Appearance/Widgets panel and you will notice that you now have two widgetized sidebars to which you can add widgets. If you followed all the steps correctly, the second one should be the one associated with your “siteinfo” page.

    Voilà, that’s all you need to do. I hope this was clear enough, but if it wasn’t, just drop me a line in the thread and I’ll give you a hand.

    Good luck!

    Marventus

    (@marventus)

    Hi Phil,

    I’m following up on this one since you never got back to me. Were you able to figure this out? Where the instructions clear enough? If they weren’t, let me know and I’ll try to be more specific.

    Good luck!

    ilightning

    (@ilightning)

    Phil may not have been able to use it but this is great info for my latest project. Thanks for the detailed instructions!

    John

    Hey all,

    I have recently built a plugin called Widgets on Pages which I think will solve this issue perfectly. It adds extra sidebars (configurable in number) which can then be added into any post or page content through the use of shortcodes.

    If you do try this out please let me know how you get on.

    Thanks,
    Todd

Viewing 4 replies - 16 through 19 (of 19 total)
  • The topic ‘How to Widgets anywhere and NOT in Sidebar’ is closed to new replies.