WordPress.org

Ready to get started?Download WordPress

Forums

Link to Category (7 posts)

  1. atillaoral
    Member
    Posted 1 year ago #

    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>

    </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.

    Regards,

  2. ahortin
    Member
    Posted 1 year ago #

    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.

  3. atillaoral
    Member
    Posted 1 year ago #

    Hi Anthony,

    http://atillaphotography.com/?p=53 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.

  4. ahortin
    Member
    Posted 1 year ago #

    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...
    http://codex.wordpress.org/Using_Permalinks

  5. atillaoral
    Member
    Posted 1 year ago #

    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.

  6. atillaoral
    Member
    Posted 1 year ago #

    I solved this problem with below.

    In single.php

    /*	<div class="metaStuff">
    			<div class="categoryStuff metaItem">
    	<?php
    $categories = get_the_category();
    $seperator = ' ';
    $output = '';
    if($categories){
    	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.]

  7. ahortin
    Member
    Posted 1 year ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.