How to use the plugin in the footer?
-
Hi!
I use the plugin in the footer, so it is outside of the loop. I display the latest posts of some categories there. Unfortunately adding the code-suggestion of the plugin does not work. If I use it like it is described ALL images of those 4 categories are shown, not only the image of the active category.My code goes like this:
<?php $myQuery = new WP_Query('showposts=4&cat=2,7,8,9'); while ($myQuery->have_posts()) : $myQuery->the_post(); ?> <div class="footerteaser"> <div class="footerteaser_bild"> <?php foreach( get_categories(['hide_empty' => false]) as $category) { echo do_shortcode(sprintf('[wp_custom_image_category term_id="%s"]',$category->term_id)); } ?> </div> <!--footerteaser_bild--> <div class="footerteaser_text"> <a href="<?php the_permalink(); ?>" title="Permalink to <?php the_title(); ?>"> <strong><?php the_title() ?> </strong> </a> <br /> <?php $mycontent=get_the_excerpt(); echo substr($mycontent,0,100); ?> </div><!--footerteaser_text--> </div><!--FOOTERTEASER--> <?php endwhile; ?> <?php wp_reset_query(); ?> </div>
Could you please help me to see my mistake? I suppose the problem is that I am out of the loop.
Thank you!
Raphael
- The topic ‘How to use the plugin in the footer?’ is closed to new replies.