Title: Variable in function option
Last modified: August 19, 2016

---

# Variable in function option

 *  Resolved [mariatmind](https://wordpress.org/support/users/mariatmind/)
 * (@mariatmind)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/variable-in-function-option/)
 * Hi i have a problem, i want pass the category title: single_cat_title() as a 
   value for the function option….
 * <?php wp_list_bookmarks(‘title_li=&categorize=0&show_name=1&show_description=
   1&category_name=**single_cat_title()**‘); ?>
 * ..bat it dosn’t work …. please help me…
 * Thank for all

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/variable-in-function-option/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/variable-in-function-option/page/2/?output_format=md)

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/variable-in-function-option/#post-1208929)
 * Try:
 *     ```
       <?php
       $ctitle=single_cat_title();
       wp_list_bookmarks('title_li=&categorize=0&show_name=1&show_description=1&category_name='.$ctitle); ?>
       ```
   
 *  Thread Starter [mariatmind](https://wordpress.org/support/users/mariatmind/)
 * (@mariatmind)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/variable-in-function-option/#post-1208958)
 * It doesn’t work … it ignore the **$ctitle**… any idea? … thanks…
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/variable-in-function-option/#post-1208974)
 * There’s an error in your use of wp_list_bookmarks. There’s no `show_name` parameter.
   Try
 *     ```
       <?php
       $ctitle=single_cat_title();
       wp_list_bookmarks('title_li=&categorize=0&show_description=1&category_name='.$ctitle); ?>
       ```
   
 *  Thread Starter [mariatmind](https://wordpress.org/support/users/mariatmind/)
 * (@mariatmind)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/variable-in-function-option/#post-1208984)
 * The how_name parameter exists in wp_list_bookmarks function
 * if i use
 * <?php wp_list_bookmarks(‘title_li=&categorize=0&show_name=1&show_description=
   1&category_name=**CATEGORIATEST**‘); ?>
 * it works
 * the proble is to pass a variable as value for **category_name** option…
 * Thanks for your time…
 *  Thread Starter [mariatmind](https://wordpress.org/support/users/mariatmind/)
 * (@mariatmind)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/variable-in-function-option/#post-1209032)
 * Noone knows if is possible?
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/variable-in-function-option/#post-1209034)
 * Is this code inside or outside The Loop?
 * And my bad with show_name but it only work when show_images is TRUE.
 * [http://codex.wordpress.org/Template_Tags/wp_list_bookmarks](http://codex.wordpress.org/Template_Tags/wp_list_bookmarks)
 *  Thread Starter [mariatmind](https://wordpress.org/support/users/mariatmind/)
 * (@mariatmind)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/variable-in-function-option/#post-1209052)
 * yes i have the image for the link and it is all ok with show name…
 * the code is out of the loop…
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/variable-in-function-option/#post-1209054)
 * Try re-reading the Codex page. You need to set show_images to TRUE if you want
   show_name to work.
 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [16 years, 9 months ago](https://wordpress.org/support/topic/variable-in-function-option/#post-1209057)
 * Using single_cat_title() as a parameter to category_name for wp_list_bookmarks
   doesn’t even make any sense.
 * Post categories and Link Categories are wholly separate. The single_cat_title()
   returns a post category, but bookmarks is expecting a link category.
 * Won’t work.
 *  Thread Starter [mariatmind](https://wordpress.org/support/users/mariatmind/)
 * (@mariatmind)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/variable-in-function-option/#post-1209058)
 * Hi OTTO
 * i knw that the link category are different from post category, but i have the
   category with same name.
 * EXAMPLE
 * Link Category name -> MOTOR
 * Post Category name -> MOTOR
 * I put the code
 * <?php wp_list_bookmarks(‘title_li=&categorize=0&show_name=1&show_description=
   1&category_name=single_cat_title()’); ?>
 * in Categoy post page to show the link of the link category with same name.
 * if i use
 * <?php wp_list_bookmarks(‘title_li=&categorize=0&show_name=1&show_description=
   1&category_name=**MOTOR**‘); ?>
 * it works
 * but i need to pass the single_cat_title() cvariable so it works for all category
 * THANKS
 *  [Adam Harley (Kawauso)](https://wordpress.org/support/users/kawauso/)
 * (@kawauso)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/variable-in-function-option/#post-1209059)
 * <?php wp_list_bookmarks(‘title_li=&categorize=0&show_name=1&show_description=
   1&category_name=**single_cat_title()**‘); ?>
    You’re trying to run a function
   inside of a string, which will make PHP treat it as part of the string. You need
   to append functions’ output or use a variable and either append that or include
   it in a string surrounded by double quotes.
 * [`single_cat_title`](http://codex.wordpress.org/Template_Tags/single_cat_title)
   by default outputs the category as text too, so you’d be better off doing something
   like:
    `<?php wp_list_bookmarks( single_cat_title( 'title_li=&categorize=0&show_name
   =1&show_description=1&category_name=', false ) ); ?>` (first parameter is the
   prefix, second tells PHP to return it as a string instead of outputting it)
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/variable-in-function-option/#post-1209062)
 * Which would be the same as:
 *     ```
       <?php
       $ctitle=single_cat_title();
       wp_list_bookmarks('title_li=&categorize=0&show_description=1&category_name='.$ctitle); ?>
       ```
   
 * Yes?
 *  [Adam Harley (Kawauso)](https://wordpress.org/support/users/kawauso/)
 * (@kawauso)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/variable-in-function-option/#post-1209063)
 * Not quite, you need to pass `false` as the 2nd argument to `single_cat_title()`
   for it to return rather than print the output. Sorry, I did see your post, but
   I think mariatmind just kind’ve skipped over it 🙂
 *  Thread Starter [mariatmind](https://wordpress.org/support/users/mariatmind/)
 * (@mariatmind)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/variable-in-function-option/#post-1209067)
 * Thanks Kawauso but i still have problems,
 * with your code it dosn’t filter the lik by category name,
 * it shows links of all the link categoy…
 * Any ideas???
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/variable-in-function-option/#post-1209068)
 * You’re right. It should be:
 *     ```
       <?php
       $ctitle=single_cat_title('', false);
       wp_list_bookmarks('title_li=&categorize=0&show_description=1&category_name='.$ctitle); ?>
       ```
   
 * {just in case anyone else reads this thread)

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/variable-in-function-option/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/variable-in-function-option/page/2/?output_format=md)

The topic ‘Variable in function option’ is closed to new replies.

## Tags

 * [single_cat_title](https://wordpress.org/support/topic-tag/single_cat_title/)
 * [wp_list_bookmarks](https://wordpress.org/support/topic-tag/wp_list_bookmarks/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 16 replies
 * 4 participants
 * Last reply from: [mariatmind](https://wordpress.org/support/users/mariatmind/)
 * Last activity: [16 years, 9 months ago](https://wordpress.org/support/topic/variable-in-function-option/page/2/#post-1209071)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
