Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Good Day All

I have a featured slider on the home page that can call a category from which it gets its featured content. Now, for each featured slider, I made a post with category 'featured'. Now the problem is, that currently when you click on the featured slide, you get directed to its originating post with category 'featured'.

<h2 class="featured-title"><a href="<?php echo esc_url($arr[$i]["permalink"]); ?>"><?php echo esc_html($arr[$i]["title"]); ?></a></h2>

Now, what I would like to achieve is to change that dynamic link (above) to point to a specific category, and the category it should point to is exactly the same as the title that makes up this link - (title = h2 featured-title text)

So the dynamic url should point to

http://siteurl.com/category/title in the above link...

Is that possible?

Thank you! Thank you

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

try this:

<h2 class="featured-title"><a href="http://siteurl.com/category/<?php echo strtolower(str_replace(" ","",$arr[$i]["title"])); ?>"><?php echo esc_html($arr[$i]["title"]); ?></a></h2>
share|improve this answer
    
Nice, this works prefect. thank you! –  DextrousDave Mar 13 '13 at 10:14
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.