I need a slider with subcategories showed
-
Hi!
I’m searching to develop a slider in the home of a custom theme, which shows the subcategories of parent cat.(ex. Articles) with their featured image.(In the link see the slider under the title “In Piemonte Puoi”, is only static html with a framework, I’m working on wordpress on localhost)
I tried to show posts from a test category, slider, changing the links in the preview, but I didn’t have success.
Here is the code of the loop for the slider showing the posts from the category slider
<?php // La Query $ipp_the_query = new WP_Query( 'category_name=slider&posts_per_page=6' ); // Il Loop while ( $ipp_the_query->have_posts() ) : $ipp_the_query->the_post(); ?> <?php $ipp_image_attributes = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'ipp_small' ); ?> <li class="uk-padding-large"> <a href="<?php the_permalink(); ?>"> <img src="<?php echo $ipp_image_attributes[0]; ?>" alt="" uk-svg> </a> <div class="uk-position-center uk-panel"> <div><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></div> </div> </li> <?php endwhile; // Ripristina Query & Post Data originali wp_reset_query(); wp_reset_postdata(); ?>
I would find a method to loop the subcategories(with their featured images) of a parent like the posts of the category slider in the code.
Another solution may be change the link of the content preview(cat. slider) to the subcategories.
Thanks for the help!
CarloThe page I need help with: [log in to see the link]
- The topic ‘I need a slider with subcategories showed’ is closed to new replies.