• gpspake

    (@gpspake)


    I’m working on a plugin and I’ve added a button to the tinymce editor that pops up a modal form, with options for the shortcode, and then inserts the shortcode with the selected options in to the post.

    The modal pops up a php file with an html form and some javascript in it. I’d like to use wp_dropdown_categories() inside of the form instead of having a text input for cats.

    Here’s a snippet. I have the original textbox I was using for category commented out and I was trying to stick that wp function in instead but it’s not working. WHat am I missing here? I can’t figure out if there’s something I need to be calling like a class or some global variable.

    <?php
        ?>
        <head>
        <title>Box Shortcode</title> 
    
        ...Some more html and some js...       
    
        <input type="radio" name="tax" value="category" id="selcat">
    
        <?php wp_dropdown_categories(); ?> //This doesn't work
    
        <!--<div class="input-append">
            <input type="text" name="category" id="catselection" class="categorynamebox" placeholder="Category" value="" disabled="disabled" />
        </div>-->
        <label for="randomcat">
        <input type="checkbox" id="randomcat" disabled="disabled" >
        Use a random category
        </label>
    
        ..some more html and js...
    
        </body>
        <?php
    
        ?>
  • The topic ‘Trouble using wordpress functions in a pop-up modal form’ is closed to new replies.