• I′m around this for days, here’s the thing:
    I want to show in one page all the categories and their posts, but I want the categories to show, at left, a thumbnail image as well for each category.
    I’m using this code to show all categories and posts:

    <?php
    
    $cat_args=array(
    'orderby' => 'none',
    'order' => 'DESC'
    );
    					$categories=get_categories($cat_args);
    foreach($categories as $category){
    $args=array(
    'showposts' => -1,
    'orderby' => 'none',
    'order' => 'DESC',
    'category__in' => array($category->term_id),
    'caller_get_posts'=>1
    ); 
    
    echo '<div id="categorias">';	
    
    echo '<div class="lista-produtos">';
    							$posts=get_posts($args);
    if ($posts) {
    
    echo '<div class="titulo-categorias"> ' . $category->name . ' </div> ';
    foreach($posts as $post) {
    							  setup_postdata($post); ?>
    
    <li><a>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
    <?php
    
    } // foreach($posts
    
    echo '</div>';
    } // if ($posts
    echo '</div>';
    
    } // foreach($categories
    
    ?>

    ———————————————————————-

    But I want to mixe it with WCK plugin… I′m trying to use this code to get the image:

    <?php $categorias = get_post_meta( $post->ID, 'categorias', true );
    foreach($categorias as $categorias) {
    $attachment_image = wp_get_attachment_image_src($categorias['imagem'], 'medium');
    echo '<div id="imagem-cat"><img class="img-tamanho" src="'. $attachment_image[0].'"/></div>';
    }
    ?>

    Who can each category item have a left image (different for all itens) with wck?
    Please help!
    Thanks.

    https://www.ads-software.com/extend/plugins/custom-fields-creator/

  • The topic ‘Multiple categories with thumbnail image’ is closed to new replies.