• Resolved MarlonDean

    (@marlondean)


    Hi everyone,

    I will attempt to be as clear as possible with this question. My site has 2 blog pages, “Blog” and “Featured Articles”. When “Featured Articles” is selected, the left sidebar widget displays my recent “Blog” posts. When “Blog” is selected, the left sidebar widget also displays my recent “Blog” posts. How can I change the widget to display my recent “Featured Articles” when the “Blog” page is shown.

    My featured articles page – (Note the left sidebar widget – it shows recent blogs) http://aerilon.za.net/category/articles/

    My blog page – (Note the left sidebar widget – it shows recent blogs, I want it to show recent featured articles) http://aerilon.za.net/category/blog/

    I had a look at the sidebar_left.php file of the theme but I am not proficient enough to see what to change

    <!-- begin r_sidebar -->
    
    <div id="sidebar_left">
    
    	<h4 class="featuredtitle"><?php echo cat_id_to_name(ot_option('hp_side_cat')); ?></h4>
    
            <?php $recent = new WP_Query("cat=" .ot_option('hp_side_cat'). "&showposts=" .ot_option('hp_side_num') ); while($recent->have_posts()) : $recent->the_post();?>
    
                <div class="sidecontent">
    
    		<a href="<?php the_permalink() ?>" rel="bookmark"><?php the_post_thumbnail( 'home-side' ); ?></a>
    		<h4><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h4>
                    <?php the_content_limit(50, ""); ?>
                    <a class="morelink" href="<?php the_permalink() ?>" rel="bookmark"><?php _e("Read More", 'organicthemes'); ?></a>
                    <div class="clear"></div>
    
                </div>
    
            <?php endwhile; ?>
    
    	<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Left Sidebar') ) : ?>
            <div class="widget">
                <h4>Widget Area</h4>
                <p>This section is widgetized. To add widgets here, go to the <a href="<?php echo admin_url(); ?>widgets.php">Widgets</a> panel in your WordPress admin, and add the widgets you would like to <strong>Left Sidebar</strong>.</p>
                <p><small>*This message will be overwritten after widgets have been added</small></p>
            </div>
        <?php endif; ?>
    
    </div>

    Can this be achieved? Any tips will be highly appreciated.

    Thank you.

Viewing 1 replies (of 1 total)
  • Thread Starter MarlonDean

    (@marlondean)

    I managed this by copying the sidebar_left.php. hardcoding which category to use for the sidebar. Then I copied category.php, renamed the file to the use the appropriate slug e.g. category-blog.php and including the appropriate sidebar_left.php

Viewing 1 replies (of 1 total)
  • The topic ‘Changing left sidebar, category template’ is closed to new replies.