Forums

dynamic sidebar (right-column) posts... (4 posts)

  1. bryko
    Member
    Posted 6 years ago #

    Hello,
    so I have two big problems... I am a guite newbie in PHP and I am coding an complicated site in WP :o. I'll try to explain what I'd like to do.

    Imagine simple two-column layout; for example, the site is of the school-like institution that organizes lectures and workshops. Now, we have a main page: on the left there is a list of news (short, full-text posts from the last month are shown). In the right column, there are short notes describing: the next lecture, the workshops for students, the workshops for teachers and a list of sponsors; all with little images. They will not be 'excerpts'; their aim is just to give a visitor an overview of what's going on.

    These right-column notes will be changing, all but the sponsors rather often, i.e. there is a new lecture every week. They do not need to be archived (so I imagine opening and overwriting each of them during each update).

    1. My first question is how do I make such a list of post that would show only and always in the sidebar? The simplest probably would be to make all of them in a special category, like 'sidebar'. But then - read on.

    Imagine somebody arrives on the main page and clicks the 'next lecture' note. He/she is then transfered to a new page where in the left is the description of the new lecture followed by an archive of the previous lectures, and in the sidebar the lecture note disappear (all remaining notes remain as they were). Similar mechanism acts when one clicks 'workshops' note: he/she is taken to the list and short descriptions of the workshops in the left, and the respective note on the right vanishes.

    2. The above means that I need a setup where the contents of the sidebar would be dependent on what is loaded in the left side and, as far as I can imagine, where each of the notes in the left would be independently manipulated. Say, every note will be in a different unique category that would contain _only_ this single note and I would construct a loop like: if the lecture description is loaded in the left, display this and this and this note on the right. So my question is how do I make the sidebar-content dependent on the left-column content and is my idea of such a 'dynamic sidebar' OK?

    Well, that's about it. I am sorry for such a long entry, I just hope you know what I what to achieve. I would be very very grateful if you could point me to the right direction. I am not afraid of learning some PHP :) , I just need some ideas and guidance how this should work to be simple and straightforward...

    This is a real-life example, I am really working on such a website. The institution is non-profit and I don't get any money or fame :) for making this website. I wasn't even asked to do it, it is just that I like the organisation very much and their current website is a crap. And besides, I'd like to learn WP :).

    cheers
    jb

  2. Lorelle
    Member
    Posted 6 years ago #

    Honestly, the short answer is to probably use "asides" or a "mini-loop" in the sidebar.

    Here are some articles that may help:

    http://codex.wordpress.org/The_Loop
    http://codex.wordpress.org/The_Loop_in_Action
    http://codex.wordpress.org/Customizing_Your_Sidebar
    http://codex.wordpress.org/Adding_Asides

    And if this is overwhelming, then start with these two articles first and you can enter the other articles armed and ready.

    http://codex.wordpress.org/Stepping_Into_Templates
    http://codex.wordpress.org/Stepping_Into_Template_Tags

    There might be another way and that is to feature a specific category in your sidebar as a feed, but someone else here will have to explain how that works.

    http://codex.wordpress.org/WordPress_Feeds
    http://codex.wordpress.org/Customizing_Feeds

  3. bryko
    Member
    Posted 6 years ago #

    Hello,
    thanks a lot for the links! Well, I knew them before, so this time I just tried harder :)
    So far I got stuck in trying to manipulate sigle sidebar posts. Example: say I have three posts in the sidebar, entitled: cats, dogs and rabbits. I would like to have the loop going on something like this:
    "if this post belongs to the category 'sidebar' and if its title is 'cats', show it"
    But somehow I am not able to get the condition:
    if (in_category('1') and the_title()=='cats') { blah blah blah }
    work... I guess there must be something wrong with the notation of the 'the_title()=='cats', but I have tried lots of different combinations and nothing seems to work.

    I would be extremely grateful for help...!

    jarek`

  4. mir123
    Member
    Posted 6 years ago #

    Check this http://wordpress.org/support/topic/37666#post-212540 which could be useful.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags