WordPress.org

Ready to get started?Download WordPress

Forums

get_category_link returns nothing (6 posts)

  1. jl2424
    Member
    Posted 5 years ago #

    I am using the following:

    <a href="<?php get_category_link(1); ?>">
    					<img src="<?php bloginfo('stylesheet_directory'); ?>/img/nav_Editorial.gif" border="0" alt="" />
    				</a>

    and so on.

    But the HTML which is generated returns this:
    <a href=""> ...

    Why does the function return nothing? The category IDs are correct.

  2. T_Van
    Member
    Posted 5 years ago #

    instead of using that, why don't you try this:

    /wordpress/category/yourcategoryname/

    make sure the file path is correct.
    This works for me.

  3. T_Van
    Member
    Posted 5 years ago #

    sorry i should be more specific:

    <a href="/wordpress/category/yourcategoryname/">
    					<img src="<?php bloginfo('stylesheet_directory'); ?>/img/nav_Editorial.gif" border="0" alt="" />
    				</a>
  4. Otenyano
    Member
    Posted 4 years ago #

    put an echo in front of it,

    <a href="<?php echo get_category_link(1); ?>">
    					<img src="<?php bloginfo('stylesheet_directory'); ?>/img/nav_Editorial.gif" border="0" alt="" />
    				</a>

    hope it helps you.

  5. jk_
    Member
    Posted 4 years ago #

    It helps!

  6. candid
    Member
    Posted 4 years ago #

    I have the following code on my home page where by 'get_category_link' used to work before I updated the WP to 2.9. Any idea where do I have to make changes? any help please?

    <p>Feel free to visit our <a href="<?php echo get_category_link(6)?>">blog</a> or take a closer look at our <a href="<?php echo get_category_link(5)?>">portfolio</a>.</p>

Topic Closed

This topic has been closed to new replies.

About this Topic