• Dear WordPressers,

    I have been working on this for quiet a while now and I cannot get this to work. It is a very basic idea for a website, and I saw a lot of requests on the forum for a similar theme but nowhere I have found the solution to this question.
    I am hard-coding the theme and have tried two options yet, but both don’t really work.

    I want and indexhibit-like website with the capabilities of WordPress. Meaning: a left sidebar with and index of all the posts and right the content of the posts.
    I want the sidebar to be a kind of searchable index, with the option of selecting categories and then getting all the posts of that category in the sidebar.
    For instance this theme wouldn’t do it since it uses pages… and I need to use categories or tags.

    For now, I used get_posts in my sidebar to get a list of all the posts but I can not find a good method to filter on categories and have the sidebar display the category archive. Possibly it is better to use a custom query for this?

    I am hardcoding the theme and I do not wish to use widgets. Any basic help and ideas on how setting up this theme are very welcome!
    If they are themes out there that match this functionality then I would be happy to hear that too.

    Thanks in advance.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Sorry, can’t help you. But I’m very interested if it works!

    Thread Starter lola rennt

    (@laurenserge)

    I am already half on the way – when completely ready I will make the theme downloadable. So you can use it.

    For now I have managed to display the posts in the sidebar by pasting the loop in there. If you click on a category it also rightfully selects only the posts from that category in the sidebar.
    My problem now is that when I click on a post it directs me to a single post page and the sidebar displays only that single post.The funny thing is that I have no single.php page… So I don’t understand why it does this.

    I want to keep all the posts in the sidebar but just have the content of the active post displayed too. This must be pretty easy – any ideas on how yo do this?

    Thread Starter lola rennt

    (@laurenserge)

    Okay, I have managed so that the single post page displays the posts from that same category in the sidebar. But still this is not what it should do.

    Ultimately I want it to work so:
    – when on index.php -> display all posts in sidebar, when you click on a post it shows the post in the right part of the screen and it retains the list of ALL the posts in the sidebar

    – when in category archive -> display all posts of the category in the sidebar, when clicking on a post it shows the posts in the right part of the screen and it retains the list of the posts of that category in the sidebar

    This seems really simple behaviour, but it seems unachievable with WordPress. I am beginning to think that I just need to use a simple javascript show hide so that I don’t need to jump to the single.php page, because that is what troubles the whole thing.
    Any ideas, comments, suggestions?

    Still can’t help you. But maybe you find a theme with exactly the function you need. just get the code and see how it’s done.

    Or check: https://codex.www.ads-software.com/Theme_Development

    Thread Starter lola rennt

    (@laurenserge)

    Yeah, I checked the theme development and many more pages before posting here. I hardcoded already 3 themes for this job but it just seems a functionality that doesn’t work that well with WordPress. Still I need to get the job done soon…

    Anyone suggestions?

    Ultimately I want it to work so:
    – when on index.php -> display all posts in sidebar, when you click on a post it shows the post in the right part of the screen and it retains the list of ALL the posts in the sidebar

    – when in category archive -> display all posts of the category in the sidebar, when clicking on a post it shows the posts in the right part of the screen and it retains the list of the posts of that category in the sidebar

    It’s like an archieve. This should be simple. Maybe you have to define the function? Don’t know. But it should be something like in every standard wordpress theme. I mean, every theme has these functions.

    Thread Starter lola rennt

    (@laurenserge)

    Okay, I got it to work. I used some detours but it works fine. I will try to explain shortly what I did.

    Note: In my theme I use three categories, but I if you have many more categories this could get complex. Still the methodology would work and I hope this sets other people on the right track.

    Using the option of variable sidebar content I set up three sidebars, each for one category. Using a custom query I defined what category should be displayed:

    <?php
    $args = array( 'numberposts' => 100, 'orderby'=> 'post_date', 'category' => 4 );
    $postslist = get_posts( $args );
    foreach ($postslist as $post) :  setup_postdata($post); ?>

    Then I set up three different category templates (these are called when clicking on a category), again, one for each category and I used this code to get the correct sidebar:
    <?php include(TEMPLATEPATH . '/sidebar-cat-yourcat.php');?>

    Then on my single.php I added this conditional statement:

    <?php
    if ( is_category('yourcat') || @$_REQUEST['cat'] == yourcatID ) {
    	include 'sidebar-cat-yourcat.php';
    } elseif ( is_category('yourcat') || @$_REQUEST['cat'] == yourcatID ) {
    	include 'sidebar-cat-yourcat.php';
    } elseif ( is_category('yourcat') || @$_REQUEST['cat'] == yourcatID ) {
    	include 'sidebar-cat-yourcat.php';
    } else {
    	include 'sidebar.php';
    }
    ?>

    And finally I added this tiny code to the title attribute of the post data after the custom query in ALL the sidebars:
    <a href="<?php the_permalink() ?>?cat=yourcatID" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
    note the ?cat=ourcatID which displays the correct url after visiting a category archive and then clicking on a post. It links to the single.php and retains the sidebar selection by calling the correct sidebar using this url:
    https://localhost:8888/yoursite/?p=11?cat=5

    I hope this makes it clear to you and other people. If you have any questions, feel free to ask.

    I don’t really get it, but sounds cool.

    And now we want to see the theme in action!

    Nothing?

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Question on theme set-up – Indexhibit like theme’ is closed to new replies.