• I am using this template: https://www.ideasfloataway.com/blog/

    And I am trying to get it so that the sidebar only posts links for category 3. I’ve looked online, and at the tutorials but I cannot figure out how to do this. The sidebar.php file looks like this:

    <div class="leftColumn">
    		<?php if ( !function_exists('dynamic_sidebar')
            || !dynamic_sidebar() ) : ?>
    
    						 <h2><span>My</span>Scripts</h2>
    
    <?php
    
    $today = current_time('mysql', 1);
    
    if ( $recentposts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'publish' AND post_date_gmt < '$today' ORDER BY post_date DESC LIMIT 10")):
    
    ?>
    
    <ul>
    <?php
    
    foreach ($recentposts as $post) {
    
    if ($post->post_title == '')
    
    $post->post_title = sprintf(__('Post #%s'), $post->ID);
    
    echo "
    <li><a>ID)."'>";
    
    the_title();
    
    echo '</a></li>
    ';
    
    }
    
    ?>
    
    </ul>
    <?php endif; ?>			
    
    <?php endif; ?>
    </div>

    Can someone please help? Thanks.

  • The topic ‘Excluding categories-I can’t figure this out.’ is closed to new replies.