0

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

1 Answer 1

1

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>
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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