Title: Replacing HTML Link with a Shortcode.
Last modified: August 22, 2016

---

# Replacing HTML Link with a Shortcode.

 *  [azubets21](https://wordpress.org/support/users/azubets21/)
 * (@azubets21)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/replacing-html-link-with-a-shortcode/)
 * Hello everyone,
 * Got my WP website running a few days ago and currently working out a few last
   tweaks. Searched for about 3 hours now and decided to come for help here.
 * So.. What am I trying to do?
 * I have a button which is currently linked to a YouTube page. I wish for that 
   youtube page to open up on my website kind of like a popup window.(I want the
   background dimmed and video put in the middle of my site and autoplay upon click
   of that button)
 * I have found a Plug in and created a shortcode (Youtube Fancy Box).
 * By inspecting the code element of a button I wish to replace the reference with
   a shortcode.
 * Original code on the page:
 *     ```
       <div class="bottom_tagline_button">
         <a href="https://www.youtube.com/watch?v=xxxxxxxx">Click ME</a>
           </div>
       ```
   
 * This is what I tried replacing it with but it didn’t work…
 *     ```
       <div class="bottom_tagline_button">
       <?php echo do_shortcode('[youtube videoid="3we5z1xzSAE" height="0" width="0"]'); ?>
       </div>
       ```
   
 * Could anyone help me out or at least consult me on this matter?
    Highly appreciate
   your help! Thanks all in advance!!

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

 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/replacing-html-link-with-a-shortcode/#post-5332927)
 * Hi azubets21
 * Can you provide a link to the Youtube Fancy Box plugin.
 * Did it come with a shortcode you can use or are you trying to create your own
   shortcode?
 * [http://codex.wordpress.org/Shortcode_API](http://codex.wordpress.org/Shortcode_API)
 *  Thread Starter [azubets21](https://wordpress.org/support/users/azubets21/)
 * (@azubets21)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/replacing-html-link-with-a-shortcode/#post-5332928)
 * YFancy Box plugin – [https://wordpress.org/plugins/youtubefancybox/](https://wordpress.org/plugins/youtubefancybox/)
 * I am trying to create my own shortcode. By inputting all the definitions within
   the plugin it generates a shortcode for me –
    ([youtube videoid=”3we5z1xzSAE”
   height=”0″ width=”0″]) exactly which i am trying to run.
 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/replacing-html-link-with-a-shortcode/#post-5332931)
 * So if I understand it correctly your shortcode wraps the fancy box plugin inside
   the .bottom_tagline_button” div.
 * Can you show us the shortcode callback function you have now?
 * Maybe the problem is that you echo the do_shortcode() function in your shortcode.
   See the output section of the API:
    [http://codex.wordpress.org/Shortcode_API#Output](http://codex.wordpress.org/Shortcode_API#Output)
 *  Thread Starter [azubets21](https://wordpress.org/support/users/azubets21/)
 * (@azubets21)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/replacing-html-link-with-a-shortcode/#post-5332937)
 * Pardon me but I do not understand what you mean by callback function.
 * All I want to change is to run a shortcode (plugin) instead of having people 
   redirected to another site (as is happening with original code).
 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/replacing-html-link-with-a-shortcode/#post-5332940)
 * Ah, I see.
 * Where are you using this?
 *     ```
       <div class="bottom_tagline_button">
       <?php echo do_shortcode('[youtube videoid="3we5z1xzSAE" height="0" width="0"]'); ?>
       </div>
       ```
   
 * In a theme template?
 *  Thread Starter [azubets21](https://wordpress.org/support/users/azubets21/)
 * (@azubets21)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/replacing-html-link-with-a-shortcode/#post-5332942)
 * Yes. It’s a premade button in a theme. (Believe it’s called roadwarrior or smth.)
 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/replacing-html-link-with-a-shortcode/#post-5332947)
 * What happens if you don’t use the width and height attributes:
 *     ```
       <div class="bottom_tagline_button">
       <?php echo do_shortcode('[youtube videoid="3we5z1xzSAE"]'); ?>
       </div>
       ```
   
 * You can also set the default width and height in the settings page for the plugin:
   
   [https://wordpress.org/plugins/youtubefancybox/faq/](https://wordpress.org/plugins/youtubefancybox/faq/)
 *  Thread Starter [azubets21](https://wordpress.org/support/users/azubets21/)
 * (@azubets21)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/replacing-html-link-with-a-shortcode/#post-5332958)
 * No, it doesn’t work and I am starting to think that the shortcode isn’t working
   at all.. This is possibly due to plugin bug..

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

The topic ‘Replacing HTML Link with a Shortcode.’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 8 replies
 * 2 participants
 * Last reply from: [azubets21](https://wordpress.org/support/users/azubets21/)
 * Last activity: [11 years, 7 months ago](https://wordpress.org/support/topic/replacing-html-link-with-a-shortcode/#post-5332958)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
