Differentiating posts

Hello all, working w/a child theme of 2014, although am sure this would apply to any theme
I would like a set of posts in the primary bar an diff set in the secondary.
I thought i could just tag & add a category to the post then specify that in the function calling it.
but it didn’t work(or i could have done it incorrectly?).
Has anyone here dealt w/this and can you please share how you fixed it?

Thank you
D

Can you show us how you did it?

Hey Guido…not much to show as I have not managed to do it. still looking at the files to see what to target.
as is functions.php of course has the widget_init area but i wouldn’t touch that to select the posts.
in sidebar-content.php there is

<?php dynamic_sidbar('sidebar-2'); ?>

so i think that is where i might add the code?
but can’t find the specific code yet were I might be able to just add category & title so only that displays in sidebar 2

ok so this was the latest thing i tried

<ul>
<?php query_posts('cat=seasonal&showposts=5'); ?>
<?php while (have_posts()) : the_post(); ?>
<li><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></li>
<?php endwhile; ?>
</ul>

I only have two posts so far I have given to a category of “seasonal” but six posts in total. according to the code above only the two seasonals ones should show up. instead all posts still show.

I can get the post i want to show up by selecting them one by one & calling them by cat & tag. but that is not automated and would need for the coder to update the code whenever there is a new “seasonal” post.

So what am I doing wrong?
thank you
D

I’ve read a bit in the WP codex, and it seems query_posts is not recommended.
If you want to change the main loop, take a look at http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts
If you want to add another loop, take a look at http://codex.wordpress.org/Template_Tags/get_posts

get_post didn’t work. & i did add wp_reset_query()
also that wouldn’t address the issue. I want only posts in certain categories to show. Not all the posts.
D

ok sharing this in case this works for someone else. thanks to chris in the wordpress.org forum for pointing me in the right direction. The one thing i haven’t gotten yet is the limiting of the posts. His way didn’t work but happy w/this progress so far.

<?php
$new_query = new WP_Query(
        'category_name=seasonal'
    );
while ( $new_query->have_posts() ) : $new_query->the_post();
?>

<li>
	<h5><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h5>
	<?php the_excerpt(); ?>	
	<hr>
</li>
<?php
endwhile;
?>

Did you try


 <?php
$args = array(
        'category_name'     => 'seasonal',
        'posts_per_page'    => '5'
    );
$new_query = new WP_Query($args);

while ( $new_query->have_posts() ) : $new_query->the_post();
?>

<li>
    <h5><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h5>
    <?php the_excerpt(); ?>
    <hr>
</li>
<?php
endwhile;
?>

that didn’t work for me the first time i tried, but will give it another shot to make sure there were no typos on my part.
thank you.