Title: Links from category
Last modified: August 19, 2016

---

# Links from category

 *  [yuliyan.slavchev](https://wordpress.org/support/users/yuliyanslavchev/)
 * (@yuliyanslavchev)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/links-from-category/)
 * Hi!
    I`m 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 - I`m 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)

 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/links-from-category/#post-1744202)
 * 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](https://wordpress.org/support/users/yuliyanslavchev/)
 * (@yuliyanslavchev)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/links-from-category/#post-1744207)
 * 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 :/
 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/links-from-category/#post-1744230)
 * 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](https://wordpress.org/support/users/yuliyanslavchev/)
 * (@yuliyanslavchev)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/links-from-category/#post-1744433)
 * I can’t understand, I`m using this:
 * wp_list_bookmarks(‘category_name=’.$post->post_title);
 * and it still doesn’t work :/
 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/links-from-category/#post-1744477)
 * Then add `echo '<h2> this is the title '.$post->post_title.'</h2>';` and make
   sure it is what you expect.
 *  Thread Starter [yuliyan.slavchev](https://wordpress.org/support/users/yuliyanslavchev/)
 * (@yuliyanslavchev)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/links-from-category/#post-1744503)
 * Yes, it is, but it doesn’t work when i`m using it as category_name :/
 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/links-from-category/#post-1744510)
 * 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.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 7 replies
 * 2 participants
 * Last reply from: [MichaelH](https://wordpress.org/support/users/michaelh/)
 * Last activity: [15 years, 7 months ago](https://wordpress.org/support/topic/links-from-category/#post-1744510)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
