Title: Problem with combining two php codes
Last modified: August 21, 2016

---

# Problem with combining two php codes

 *  Resolved [SaLiXeM](https://wordpress.org/support/users/salixem/)
 * (@salixem)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/problem-with-combining-two-php-codes/)
 * Hello,
    I have installed a plugin that can show a box with a message inside using
   a php code in theme.Here is the code that shows the box:
 * `<?php if(function_exists('stbHighlightText')) stbHighlightText('Test of function.','
   warning'); ?>`
 * I want to place the category description instead of “Test of function” using 
   this code:
 * `<?php echo category_description( $category_id ); ?>`
 * I had tried to place the whole php code for category description into the first
   php code like this but it didn’t work.
 * `<?php if(function_exists('stbHighlightText')) stbHighlightText('<?php echo category_description(
   $category_id ); ?>', 'warning'); ?>`
 * Whats the problem?

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

 *  [Chris](https://wordpress.org/support/users/zenation/)
 * (@zenation)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/problem-with-combining-two-php-codes/#post-4246093)
 * You’re a) nesting PHP inside PHP (only one open tag is allowed) and b) you’re
   wrapping the code inside quotation marks so it will be handled as a plain text
   string.
 * Try this instread:
 *     ```
       <?php
       if( function_exists( 'stbHighlightText' ) ) {
         stbHighlightText( category_description( $category_id ), 'warning' );
       }
       ?>
       ```
   
 *  Thread Starter [SaLiXeM](https://wordpress.org/support/users/salixem/)
 * (@salixem)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/problem-with-combining-two-php-codes/#post-4246095)
 * Yes it works!
    Really thanks mate.
 *  Thread Starter [SaLiXeM](https://wordpress.org/support/users/salixem/)
 * (@salixem)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/problem-with-combining-two-php-codes/#post-4246102)
 * Now I want to show it only if user is viewing category page, and not in every
   archive like tags etc.
    Can anyone help me?
 *  [Chris](https://wordpress.org/support/users/zenation/)
 * (@zenation)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/problem-with-combining-two-php-codes/#post-4246111)
 * Maybe like this
 *     ```
       <?php
       if( function_exists( 'stbHighlightText' ) && is_category() ) {
         stbHighlightText( category_description( $category_id ), 'warning' );
       }
       ?>
       ```
   
 * You can also show this only for specific categories or a bunch of categories:
   [http://codex.wordpress.org/Function_Reference/is_category](http://codex.wordpress.org/Function_Reference/is_category)
 *  Thread Starter [SaLiXeM](https://wordpress.org/support/users/salixem/)
 * (@salixem)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/problem-with-combining-two-php-codes/#post-4246198)
 * Thank you Chris 🙂

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

The topic ‘Problem with combining two php codes’ is closed to new replies.

## Tags

 * [category](https://wordpress.org/support/topic-tag/category/)
 * [description](https://wordpress.org/support/topic-tag/description/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 5 replies
 * 2 participants
 * Last reply from: [SaLiXeM](https://wordpress.org/support/users/salixem/)
 * Last activity: [12 years, 7 months ago](https://wordpress.org/support/topic/problem-with-combining-two-php-codes/#post-4246198)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
