Categories Images
[resolved] Image category with external link (_blank) (2 posts)

  1. moisb
    Posted 3 years ago #

    Hi, how to add external link for this image? Example: in my template i put this: <a href="<?php echo get_category_link($cat->term_id); ?>"><img src="<?php if (function_exists('z_taxonomy_image_url')) echo z_taxonomy_image_url(); ?>" alt="<?php single_cat_title('Cupons desconto '); ?>" /></a>
    But on <a href="<?php echo get_category_link($cat->term_id); ?>"> link to category, I want this category image link to external link. Example: category image "Best Buy" link's to "www.bestbuy.com". How?

  2. Muhammad
    Plugin Author

    Posted 3 years ago #

    Simply don't use get_category_link() function and put your external link instead :)
    And if you where in loop and want one of these categories to open an external link just check using a php code, for example:
    <a href="<?php if($cat->term_id == 1) echo "www.externallink.com"; else echo echo get_category_link($cat->term_id); ?>" >
    As "1" is the id of the category that you want it to to open the external link.

    Thanks and hope I helped.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Categories Images
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic