I have some Html& js code relating to this dropbox button by WordPress plugin 1- I want to insert the button in a specifc page for example I have sample page and Sec Page I want to specifiy the page because it's in all the pages

2- When I install the plugin always appears in the beginning of the website so How to make it in a spcific div for example in the page I'll select

Dropbox button

I'm using add_action() function it works but as I mentioned appears in every page and in the beginning

    function hook_html()

 <script type="text/javascript" src="https://www.dropbox.com/static/api/2/dropins.js" id="dropboxjs"

 <div id="dropboxContainer">hellodrooppp</div>


  add_action('wp_head', 'hook_html');

1 Answer 1


As you want to insert the button on only one/few specific pages you can simply create a shortcode[Reference] and insert it on specific page/pages.

Your code will be something like:

function hook_html(){
     //function body
add_shortcode( 'dropbox_button', 'hook_html' );

And then just edit the specific pages and add the shortcode [dropbox_button] to them, you can also choose to add this in any section of the page that you want.

  • I think 'dropbox_button' is the tag? but what is it? in the reference that should be return value but in my case I don't have return value. and how to select the page that I want to insert in. Thanks in advance.
    – Steve
    Jun 20 at 19:10
  • Hi @Steve 'dropbox_button' is the shortcode. You can go to any page and edit it add the shortcode as [dropbox_button] with the square brackets and the code in function will execute on that page.
    – Manas
    Jun 29 at 18:00
  • Yes It worked thanks. Can I use add_shortcode with html class ofr div's id or select specifc page div? because it's a plugin and I can't tell everyone you've to edit the page to run the plugin, so I need something globally. –
    – Steve
    Jun 30 at 10:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.