• Hi Guys,

    I have created a template page as in this topic to load all the posts from the category with identical name as the page title.

    This way it is possible to have a page-type category page.

    That code works great, but now I need the category link (in the post info) pointing to that template based page. As for now they point to the url: /category/category-name

    I have created a (template based category) page for each category to show only those posts in that category on that page. These page titles are the same as the category names. The url for these pages are: /category-name.

    What PHP code can create the url in which the category name is being used in? How the get the category name to create the url?

    The code I do have here is:
    <h2 class="post-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><span class="category"><?php the_category(', '); ?></span></h2>

    Can anyone help me out, I have been struggling with this for 9 hours already……I hope you can solve the puzzle for me.

  • The topic ‘code te create url based on category name’ is closed to new replies.