Title: Include text string in shortcode
Last modified: August 19, 2016

---

# Include text string in shortcode

 *  [SFGolfer](https://wordpress.org/support/users/sfgolfer/)
 * (@sfgolfer)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/include-text-string-in-shortcode/)
 * I am attempting to pass a text string into my shortcode:
 * `[tooltip screen="Test link" popup="Does this test actually work?"]`
 * This is in my functions.php:
 *     ```
       function wp_tooltip($atts) {
       	extract(shortcode_atts(array(
       		"screen" => '',
       		"popup" => ''
       	), $atts));
       	return '<abbr style="border-bottom: black 1px dashed; cursor: pointer;" title=' . $popup . '>' . $screen . '</abbr>';
       }
   
       if ( function_exists('add_shortcode') )
       	add_shortcode('tooltip', 'wp_tooltip');
       ```
   
 * But it doesn’t work because of the spaces in the text string. Any ideas?

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

 *  Thread Starter [SFGolfer](https://wordpress.org/support/users/sfgolfer/)
 * (@sfgolfer)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/include-text-string-in-shortcode/#post-1442430)
 * Further, both the screen link and tooltip includes double quotation marks.
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/include-text-string-in-shortcode/#post-1442491)
 * it seems to work if you surround the strings in your shortcode with single quotes,
   like so:
 * `[tooltip screen='"Test link"' popup='"Does this test actually work?"']`
 * first of all, you get the double quotes shown in the post, and it shows the full
   tooltip.
 *  Thread Starter [SFGolfer](https://wordpress.org/support/users/sfgolfer/)
 * (@sfgolfer)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/include-text-string-in-shortcode/#post-1442509)
 * Yes it does work but I don’t wont quotation marks (single or double) to appear.
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/include-text-string-in-shortcode/#post-1442514)
 * the quotes for the title were missing in the code:
    this should work:
 *     ```
       return '<abbr style="border-bottom: black 1px dashed; cursor: pointer;" title="' . $popup . '">' . $screen . '</abbr>';
       ```
   
 *  Thread Starter [SFGolfer](https://wordpress.org/support/users/sfgolfer/)
 * (@sfgolfer)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/include-text-string-in-shortcode/#post-1442671)
 * Nope. Didn’t work either. There’s just something about the quotation marks being
   used in both the shortcode and function.

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

The topic ‘Include text string in shortcode’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 2 participants
 * Last reply from: [SFGolfer](https://wordpress.org/support/users/sfgolfer/)
 * Last activity: [16 years, 2 months ago](https://wordpress.org/support/topic/include-text-string-in-shortcode/#post-1442671)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
