WordPress Plugin- How to Insert Html&JS code in specific Page and specific Div

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 … Read more

Seperate plugin and theme files

You shouldn’t link directly to plugin/theme PHP files to handle requests for this exact reason – the WordPress environment won’t be loaded, hence your undefined function error. Since you’ve implemented a shortcode-approach to integrate with the theme, you could just point the form to itself (i.e. remove the action attribute) and then dynamically handle the … Read more