Pass Html button through a WordPress Plugin with add_shortcode

Viewed 15

I'm making wordpress plugin through wp-content/plugins folder and I want to pass Dropbox button into a specific page but I get undefined add_shortcode

this's the html code I want to pass in the plugin currently indeed

<!DOCTYPE html>
<html lang="en">
    
    <head>
        <link rel="stylesheet" href="style.css">
    
    
    
        <!-- Dropbox library for importing the Dropbox button the webpage  -->
        <script type="text/javascript" src="https://www.dropbox.com/static/api/2/dropins.js" id="dropboxjs"
            data-app-key="XXXX></script>
 
    
    <body>
        <div class="dropbox_btn" style="  margin: auto !important; width: 50% !important; ">
            <!-- dropboxContainer is the id of Dropbox button which will be added in script.js file -->
            <div id="dropboxContainer"></div>
        </div>
    
    </body>
    
    </html>
    
    
    <?php
   
    define("ABSPATH", "C:/xampp/htdocs/wordpress/");
    require_once(ABSPATH . 'wp-includes/shortcodes.php');
    require_once(ABSPATH . 'wp-includes/functions.php');
    
    function dropbox()
    {
    
        $text = "Dropbox APi Plugin";
        return $text;
    }
    
    
    
    add_shortcode('example', 'dropbox');
0 Answers
Related