• Hello,

    I am looking to include a 3rd sidebar in this page. The content in the left handside will need to be editable through wordpress, as well my event management system needs to be inputted there.

    I created a template for this page which calls out my sidebar, but when I add new content to the page it just bumps everything down.

    How do I have a sidebar on the right – while allowing the left hand side to be editable through the dashboard? Can I place <?php include(TEMPLATEPATH . '/sidebar3.php'); ?> in a wordpress page?

    Many thanks!

    Natasha

Viewing 13 replies - 1 through 13 (of 13 total)
  • You need to bump down the #whats_right width attribute. 380px works for me.

    Thread Starter nashproductions

    (@nashproductions)

    Sorry – but how did you call out the sidebar?

    I didn’t, I was just looking at the DOM element where your sidebar would be.

    As for the sidebar, you will need to add that snippet to sidebar.php, you can’t add it through a WordPress page or in a widget unless you specifically have a plugin that allows php execution in WordPress pages/widgets.

    Thread Starter nashproductions

    (@nashproductions)

    Okay – I have the two columns set up the page – but I want the right hand one to have the sidebar in it.

    In my past experience I have set up new sidebars on pages by creating a new page template – except for this one I need to be able to add content via wordpress, hoping this makes sense? ?

    I am wondering what the code is to put into my classes.php that will allow all content inputted on the page to be in the left column.

    I am confusing myself but I swear it’s quite clear in my head!

    There are a few ways you could do this:

    1. Assign a page or a post as the content for the sidebar. In the sidebar3.php page, create a WP_Query or get_post() loop and pull that content in.
    2. Use a text widget or something
    3. Use a Plugin (don’t know of any specifically at this time though)

    I’d personally recommend the first option.

    Thread Starter nashproductions

    (@nashproductions)

    ohhh, interesting. I’ve never done anything like option 1 – just to clarify:

    I have sidebar3.php – which currently has:

    <div>
    <ul>
    <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(3) ) : else : ?>
    <?php endif; ?>
    </ul>
    </div>

    So do I include a WP_Query in there?

    Or would I put the query in my classes.php which already calls out my header, footer and content, and just make it have a left and right column, right column would be sidebar, left column would be where I would assign the page??

    Still confused, I think.

    Here’s what I’d do. create a separate sidebar-classes.php file. Then in your classes.php template file, do <?php if ( function_exists(‘dynamic_sidebar’) && dynamic_sidebar(classes) ) : else : ?>
    <?php endif; ?>

    and in the sidebar-classes.php do: https://pastebin.com/nAZjW1KL

    replace the p=”x” with the id of the post you want to pull in.

    edit: oops, error, edited the pastebin. It’s early here, lol.

    Thread Starter nashproductions

    (@nashproductions)

    Okay – I think I’ve got it! What about if it’s a page not a post I want to put in though?

    Many thanks dgilfroy – you’ve been quite the help!

    Thread Starter nashproductions

    (@nashproductions)

    whoops – gilfoy!

    No problem Nash! It should work as a page or a post with p=id. If not, add ,”post_type”=>”page” right after “p”=”x”

    Thread Starter nashproductions

    (@nashproductions)

    Wait – if I’m understanding this right it appears that I am to call out my sidebar which will have the call out to my post inside of it?

    I want to have:

    Left column – page content

    Right column – sidebar3.php

    Are you saying my page content will also be a separate php file that will call out the page – and put it in my left column?

    Hmm, not sure what you mean. Let me see if I get what you want.

    On the “Whats On” page (classes), you want to pull the usual data in the main content area (left column). This works already. (I’m assuming)

    In the sidebar you want editable content (hence the page), which you can call “Whats on sidebar” as the page or post title, or whatever you want.

    The code I gave you for your sidebar will not affect the main content (left side). It will pull from a separate page or post, and place the content you want in the sidebar (right side).

    You can put that code in the classes.php template file if you want. I only suggested you put it in a separate sidebar-classes.php file for re-usability, in case you wanted to use the sidebar on another page for some reason.

    Thread Starter nashproductions

    (@nashproductions)

    Okay nevermind I figured it out! I just used an old page template and updated the sidebar call out – thanks for everything!!!

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Show sidebar to dynamic page that will be edited?’ is closed to new replies.