WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Selectable sidebars and widget areas (9 posts)

  1. jamesg40
    Member
    Posted 1 year ago #

    I am developing a series of wordpress themes and I have had nothing short of pure joy completing them, however, I have run across a particular problem that has kept me up the last few nights. What I want to do is to go ahead and create my sidebar and widget areas in both my functions and sidebar.php files and then have them be select-able from the page editor. Say for instance you go and create a page and name it "Contact Us" just say for instance. When the user creates the page, I would like to have a container (i.e. just like "Publish" "Page Attributes" "Featured Image" and so on..) that would contain a list of available sidebars or widget areas that "Once Selected" will display on that page.
    I do know exactly how to use "Conditionals and Arrays" to state that, if this page is "Contact" then use this sidebar or widget area, however my goal is to make it completely up to the user and not leave them stuck with the sidebar for the contact page if they dont want it. I would like to have a list in the page editor that would allow them to select a sidebar or widget area at will for any page they create... Make sense? Anyways, can anyone tell me or give me an idea of how to tie this into the page editor and how I could create this functionality? Any help would be greatly appreciated.

    [No bumping, thank you.]

  2. jamesg40
    Member
    Posted 1 year ago #

    Ok, im not trying to bump this or whatever, I just cant believe that no one has any answer for this after 4 days.... Did I post this question to the wrong crowd or section of the forums? Can anyone help me with this at all, lol. :-) ?

  3. jamesg40
    Member
    Posted 1 year ago #

    Hmmm, I guess no one here has the skill to help me with this, maybe if I go to Warrior forums I can get someone who can help, lol.... Just joking, well not really, but yeah. ok.

  4. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    Perhaps looking at some plug-ins for dynamic sidebars or widgets would give you some hints if you want to code it into the theme.

  5. jamesg40
    Member
    Posted 1 year ago #

    I would really rather not use a plugin as I want it built into this theme so that the sidebar is selectable just like a page template is selectable. As a matter of fact, I would like to have the selection just below the page template selector in the new page or edit page screen! I have not found a plugin to do this, can you recommend one?

  6. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    I wasn't suggesting that you use a plug-in, but that the coding of a plug-in that does what you want may be useful in figuring out how to code it. No idea if that's the case, but tossed it out there since you'd had no responses. Ignore if it's not helpful :).

  7. jamesg40
    Member
    Posted 1 year ago #

    Oh, yes... this info is very helpful. I will look around to find a similar plugin to do this function. If I can find one, it will be most helpful in helpimng me to write mine. Thanks for the help WPyogi!

  8. sparklogix
    Member
    Posted 1 year ago #

    @jamesg40, did you find a solution for this? I'm looking for the exact same functionality. Thanks!

  9. jamesg40
    Member
    Posted 1 year ago #

    Actually I have not. It seems that no one here or at any php forums can help with this. Basically I ended up creating the sidebar.php and the widget areas and simply used "if this page is" "then use this widget" ect. It did absolutely nothing for the ability to choose the sidebar for a page by selecting it in the dashboard via drop down menu or something similar. I guess i will never know how to do it.

Topic Closed

This topic has been closed to new replies.

About this Topic