WordPress.org

Ready to get started?Download WordPress

Forums

Change sidebar design on refresh?... (3 posts)

  1. shawncbarry
    Member
    Posted 2 years ago #

    I'm building a custom theme, so my sidebar is custom HTML/CSS design utilizing the sidebar.php file. Been searching for a way to do this using php random and such, and WP plugins, but so far no one's talked about just showing a differently designed same sidebar on refresh, at least that I've seen.

    To be (I hope) clearer: theoretically, if I have sidebar1.php and sidebar2.php which have the same size and content, but the background colours are different so when you hit refresh on the page or a new page, one or the other will load randomly.

    Is there a way to call one or the other sidebars randomly? Or, can one side bar load a random set of HTML tags from within the same php file, or an external HTML file?

    It's just a little design touch, not functionally different. Easy? Agonizingly complicated? Anyone?

  2. RichardWPG
    Member
    Posted 2 years ago #

    Do you mean the widgets of your sidebar?

  3. shawncbarry
    Member
    Posted 2 years ago #

    Hi Richard. I seem to be on a running streak of explaining myself badly. I'll try to explain it another way:

    In my page template, there's the php function get sidebar. Get sidebar, gets the sidebar. The entire sidebar is just divs and links, designed into the sidebar.php file. No widgets or anything. So, I'm trying to see if there's a way for the get sidebar function to randomly call from 2 different sidebar php files on page refresh. The only difference is the way the sidebar background colours and text colours are styled, via css.

    Put another way, I'd like get sidebar to be able to randomly grab from 2 different sidebars. Make sense?

Topic Closed

This topic has been closed to new replies.

About this Topic