• Hi!
    Im using wordpress 3.0.1 and custom theme. I want to add links in the sidebar. But I want to show the links from category name which I want to be the same as the current page. For example - Im on Page called Service, and I want to show all the links(if they exist) in category with the same name.
    I`m using this code:

    <?php
    		$parent_title = get_the_title($post->post_parent);
    
    		$args = array(
    		'category_name'    => 'Dental Service',
    		'echo'             => 1,
    		'categorize'       => 1,
    		);
    		wp_list_bookmarks($args);
    		?>

    Thanks in advance and I`m sorry for my “English” 🙂

Viewing 7 replies - 1 through 7 (of 7 total)
  • From my notes:

    If a ‘category’ view, display links with same category

    <?php
    if ( is_category() ) {
    $cat = get_query_var('cat');
    $category=get_category($cat);
    wp_list_bookmarks('category_name='.$category->cat_name); } ?>
    }
    ?>

    Thread Starter yuliyan.slavchev

    (@yuliyanslavchev)

    This shows me all the links…
    I don’t know what is wrong with my code – I’ve got a var of the page-title(or its parent if its child), but when I put it in the “category_name” argument, doesn’t work :/

    If you are on a page, then $post->post_title may be your page title assuming you are in the loop.

    Thread Starter yuliyan.slavchev

    (@yuliyanslavchev)

    I can’t understand, I`m using this:

    wp_list_bookmarks(‘category_name=’.$post->post_title);

    and it still doesn’t work :/

    Then add echo '<h2> this is the title '.$post->post_title.'</h2>'; and make sure it is what you expect.

    Thread Starter yuliyan.slavchev

    (@yuliyanslavchev)

    Yes, it is, but it doesn’t work when i`m using it as category_name :/

    Try

    $cat_id = get_cat_ID('whateveryourcategory');
    wp_list_bookmarks('category='.$cat_id);

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Links from category’ is closed to new replies.