Membership is FREE – with unlimited access to all features, tools, and discussions. Premium accounts get benefits like banner ads and newsletter exposure. ✅ Signature links are now free for all. 🚫 No AI-generated (LLM) posts allowed. Share your own thoughts and experience — accounts may be terminated for violations.

Add text to Category link

Status
Not open for further replies.
Joined
Apr 19, 2010
Posts
1,446
Reaction score
13
Been searching for this and trying for the last hour and I cant seem to find a solution.

Does anyone know how I add a word to the Wordpress Category link and make them part of the clickable link:

<div class="category"><?php the_category(', ')?></div>

I know I can add words to it but those are not clickable, but how do i make them part of the link so they are clickable?

Many thanks.
 
Thanks Pete, sorry for my limited knowledge but how do I implement this?

Have tried different versions of the code but I keep getting an error message.

Thanks again.
 
I think it probably only works within the loop. I don't really know where you are trying to put it?

This code would work for showing a link to the current category.

<a href="<?php echo get_category_link($category->cat_ID); ?>">Blah <?php echo $category->cat_name; ?></a>
 
I think it probably only works within the loop. I don't really know where you are trying to put it?

This code would work for showing a link to the current category.

<a href="<?php echo get_category_link($category->cat_ID); ?>">Blah <?php echo $category->cat_name; ?></a>

Thanks Peter, tried that but now the category just points to the homepage of the website, not to the actual category the article is posted in.

I have tried to replace the original code with the code above.
 
PM (or post here if you don't mind) the template which you want to update.
 
Thanks Peter, tried that but now the category just points to the homepage of the website, not to the actual category the article is posted in.

I have tried to replace the original code with the code above.

The way I understand it, you are trying to add a category then click it and it redirects to the proper category of your site. Have I understand it right? It should not be much of a problem.
 
Status
Not open for further replies.

Rule #1: Be Respectful

Do not insult any other member. Be polite and do business. Thank you!

Premium Members

New Threads

Domain Forum Friends

Our Mods' Businesses

*the exceptional businesses of our esteemed moderators
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Siusaidh AcornBot:
    Siusaidh has left the room.
      Siusaidh AcornBot: Siusaidh has left the room.
      Top Bottom