Support » Fixing WordPress » Link to Category

  • Hi Everybody,

    I am wordpress beginner user.
    I have a problem.

    I want add a link to my category in single.php area.
    I reorganised my comments area in single.php and it is like this.

    <div <?php post_class(); ?>>

    <h2 class=”posttitle”><?php the_title(); ?></h2>

    <div class=”metaStuff”>
    <div class=”categoryStuff metaItem”><?php the_category(‘, ‘); ?></div>


    My problem is here <div class=”categoryStuff metaItem”><?php the_category(‘, ‘); ?></div>

    I can’t add link area to my catalogue.
    If anybody help me i will very happy.


Viewing 6 replies - 1 through 6 (of 6 total)
  • The the_category() function will display a link to the category or categories a post belongs to. Is this not what you want? This function must be used within The Loop.

    Hi Anthony, please visit my page.
    I have catalogue name as Portfolio but It is showing me links as ?cat=1 and title writing something. I could not change it.

    I want this catalogut link must be go to directly my web address. I don’t want go to ?cat=1…Because of if i change this title message will be removed also.

    It sounds like you simply need to set your Permalinks. Go to your SETTINGS > PERMALINKS page and choose which option you would like to use for your site URL’s. Next to each option is an example URL. After you change the Permalinks, your Portfolio link will display in this new format.

    You can find out more on WordPress Permalinks on this page…

    Thank You Anthony.

    I need put a link this catalogue on posttitle section.
    Permalinks are not solved that problem.

    If anybody click to link then it will go to what i write on that.

    I solved this problem with below.

    In single.php

    /*	<div class="metaStuff">
    			<div class="categoryStuff metaItem">
    $categories = get_the_category();
    $seperator = ' ';
    $output = '';
    	foreach($categories as $category) {
    		$output .= '<a href="your link">name ) ) . '">'.$category->cat_name.'</a>'.$seperator;
    echo trim($output, $seperator);
    ?> */

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. As it stands, your code has been permanently damaged/corrupted by the forum’s parser.]

    Glad you sorted it out. Can you please mark this Topic as Resolved.
    Thanks for that 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Link to Category’ is closed to new replies.