WordPress.org

Support

Support » Themes and Templates » [Resolved] Archives Sidebar

[Resolved] Archives Sidebar

  • I am very new and just have one small question I believe.

    I want the archive page to display like the other pages, meaning:

    I was the 2 columns so I can display the sidebar for widgets. I have used the php to show sidebar and that works, it just doesnt show up on the side. 🙂 Can you tell me what to do?

    Thanks

Viewing 6 replies - 1 through 6 (of 6 total)
  • Theme Author ruphel

    @ruphel

    Your Sidebar options are found in the Dashboard > Appearance > Customize. On the Customize screen on the sidebar on the left hand side there are options to control the layout of your website. The option you select will enabled throughout your website. So to change the layout of any given page you’ll need to create a page-template.

    see: http://wordpress.org/support/topic/adding-content-below-the-widget-on-the-front-page?replies=5

    Hope this helps 🙂

    Thanks for the response. Yes, I know of that location, however on the archives page it shows full width, not with the sidebar, every other page displays correctly. Maybe something wrong during the install?

    I have it selected on 1 sidebar – right, which has been the selection since I set it up.

    Does the archive page by default follow this same structure? If so, your thoughts on why it would not be.

    Thanks

    Theme Author ruphel

    @ruphel

    Not sure sure why that is Chrissnap. But I ‘ll look into it. I haven’t got the time just now, so I’ll get back to you tomorrow, there is probably a bug. I’ll take a look and will send you on a fix for it!

    It would great if you could send a link, thanks.

    Music App

    just starting this site, so started putting in some audio posts and adding to the podcast page and that is when i noticed it. I have the archive widget on the sidebar, but when I go to one of the archive pages, the sidebar disappears.

    Let me know anything else you need. Thanks again.

    [Moderator Note: No bumping, thank you.]

    Ruphel,

    Not bumping but dont know another way to contact you. Have you had any luck with this though yet?

    Theme Author ruphel

    @ruphel

    Hi Chris

    Sorry for not getting back a lot sooner, I did look into this, but as your new to WordPress there is really nothing for it but to go into complex code.

    The only way I could think of solving this problem was for you to create a custom category template with a custom query. But after testing that would end with the same result.

    What I now think what would be best for you is to create your own page_podcast.php template file and then add a custom query!

    <?php
    /*
    Template Name: Podcast Archive
    */
    
    get_header();
    
    //Your Custom Query will go here
    
    get_footer();
    

    You can copy full width templates that already exist, just make sure you’re logged out when copying and pasting the source code. This will involve knowing where the header.php ends and where footer.php begins, or because you have the entire page markup available you don’t have to call either, which would be easier. To give you the basic idea, I’ve included the code below.

    /*
    Template Name: Podcast Archive
    */
    
    <DOCTYPE html>
    
    ...... page markup .......
    
    //Your Custom Query will go here
    
    .......
    </html>
    

    You can read more about custom page templates here:
    http://codex.wordpress.org/Page_Templates

    Now, for the important part: The Custom Query.

    First you’ll need make a category called ‘podcast’. Next, on your Admin menu go to Posts > Categories and click on the ‘podcast’ category. This will bring you to the category’s page. Look up at you address bar, you’ll see it end with something like:

    ?action=edit&taxonomy=category&tag_ID=4&post_type=post
    

    Here the ID is ‘4’

    Now that you know the ID, we use WP_Query because is the best and safest and most reliable way to query the database.

    <?php
    $args = array('cat' => 4); //because 4 is the ID
    $category_posts = new WP_Query($args);
    
    if($category_posts->have_posts()) :
    while($category_posts->have_posts()) :
    $category_posts->the_post();
    ?>
    <h2><?php the_title() ?></h2>
    //below you can use the_excerpt() or delete the line
    <div class='post-content'><?php the_content() ?></div>
    <?php
    endwhile;
    else:
    ?>
    Sorry, but there are no Podcasts.
    <?php
    endif;
    ?>
    

    For more info on WP_Query see:
    http://codex.wordpress.org/Class_Reference/WP_Query

    Again sorry for the delay, there will a lot of work getting this done right. I think the website looks good as is!

    All the best

    Ruairi

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Resolved] Archives Sidebar’ is closed to new replies.