Title: Using page title as variable
Last modified: September 15, 2021

---

# Using page title as variable

 *  Resolved [gorshan44](https://wordpress.org/support/users/gorshan44/)
 * (@gorshan44)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/using-page-title-as-variable/)
 * Hi, great job with the plugin. Only one thing, is it possible to use the page
   title as a variable in the title and/or description of the popups. For example
   if I have a page called “Cool shoes”, can I have a popup triggered with title“
   If you like Cool shoes click here”?

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

 *  [Predrag – WPMU DEV Support](https://wordpress.org/support/users/wpmudev-support1/)
 * (@wpmudev-support1)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/using-page-title-as-variable/#post-14873916)
 * Hi [@gorshan44](https://wordpress.org/support/users/gorshan44/),
 * I’m afraid that there’s no such option within Hustle, but what you can do is 
   register a new shortcode that will call page title and use that in your Popup
   content. Shortcode in titles are not support so it would need to be added into
   content directly, but you can use CSS or set the text as heading type.
 * What you would need to do first is create a new .php file inside wp-content/mu-
   plugins/ folder (if you don’t have mu-plugins folder simply create your own).
   
   You can set whatever name for that .php file and paste this code inside it:
 *     ```
       <?php
       // Add Shortcode for Page Title
       function page_title_shortcode() {
   
       	$title = get_the_title();
       	return $title;
   
       }
       add_shortcode( 'my_page_title', 'page_title_shortcode' );
       ```
   
 * Save the file and you’re able to add title now by using **[my_page_title]** shortcode.
 * Here’s how it would look in your popup content backend:
 * > [View post on imgur.com](https://imgur.com/A73ZM0Q)
 * And this is how it’s being displayed on frontend:
 * > [View post on imgur.com](https://imgur.com/M3hheuF)
 * Hope this does the trick for you.
 * Cheers,
    Predrag
 *  Thread Starter [gorshan44](https://wordpress.org/support/users/gorshan44/)
 * (@gorshan44)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/using-page-title-as-variable/#post-14875150)
 * BOOM! You’re an absolute star Predrag, I just quickly tested in dev and it worked
   out first try. Thank you so much for providing the code too!

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

The topic ‘Using page title as variable’ is closed to new replies.

 * ![](https://ps.w.org/wordpress-popup/assets/icon-256x256.gif?rev=3446944)
 * [Hustle - Email Marketing, Lead Generation, Optins, Popups](https://wordpress.org/plugins/wordpress-popup/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordpress-popup/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordpress-popup/)
 * [Active Topics](https://wordpress.org/support/plugin/wordpress-popup/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordpress-popup/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordpress-popup/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [gorshan44](https://wordpress.org/support/users/gorshan44/)
 * Last activity: [4 years, 8 months ago](https://wordpress.org/support/topic/using-page-title-as-variable/#post-14875150)
 * Status: resolved