Forum Replies Created

Viewing 1 replies (of 1 total)
  • kara_kedi

    (@kara_kedi)

    @zinifexer thanks, your code works perfect.

    https://eisabainyo.net/weblog/2010/03/10/display-5-latest-posts-in-each-category-in-wordpress/
    I want to change but another post lists are

    Display 5 posts in each category in, problem.
    Please help obtain very pivotal for me

    <?php
    $cat_args = array(
    	'taxonomy' => 'work_category'
    
    );
    $categories =   get_categories($cat_args);
    foreach($categories as $category) {
        echo '<dl>';
        echo '<dt> <a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a></dt>';
         $post_args = array(
          'numberposts' => 5,
           'post_type' => 'work',
          'taxonomy' => $category->term_id
        );
        $posts = get_posts($post_args);
    
    	foreach($posts as $post) {
    	?>
    		<dd><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></dd>
    	<?php
    	}
    	echo '<dd class="view-all"> <a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>View all posts in ' . $category->name.'</a></dd>';
    	echo '</dl>';
    }
    ?>
Viewing 1 replies (of 1 total)