Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have created pop up tiny mce window.But this is not inserting the value when i click create shortcode.

<code>
<!DOCTYPE html>
<head>
<title>Create Gallery Shortcode</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>

<script type="text/javascript" src="../../../../../../wp-includes/js/tinymce/tiny_mce_popup.js"></script>
<script type="text/javascript">
    var GalleryTiny = {
e: '',
init: function(e) {
    GalleryTiny.e = e;
    tinyMCEPopup.resizeToInnerSize();
},
insert: function createGalleryShortcode(e) {
    //Create gallery Shortcode
    var postID = $('#GalleryPostID').val();
    var columns = $('#GalleryColumns').val();
    var size = $('#GallerySize').val();

    if(size == '') {
        size = 'thumbnail';
    }

    var output ='[gallery';
    if(postID) {
        output += 'id="'+postID+'" ';
    }
    if(columns) {
        output += 'columns="'+columns+'" ';
    }
    if(size) {
        output += 'size="'+size+'" ';
    }

    output += ']';

    tinyMCEPopup.execCommand('mceReplaceContent', false, output);

    tinyMCEPopup.close();

    }
}
tinyMCEPopup.onInit.add(GalleryTiny.init, GalleryTiny);
    </script>
</head>
<body>
<form id="GalleryShortcode">
    <p>
        <label for="GalleryPostID">Post ID (Leave blank for current post):</label><br/>
        <input id="GalleryPostID" type="text" value="" />
    </p>
    <p>
        <label for="GalleryColumns">Number of Columns:</label><br/>
        <input id="GalleryColumns" type="text" value="" />
    </p>
    <p>
        <label for="GallerySize">Thumbnail Size (Leave blank for thumbnail):</label><br/>
        <input id="GallerySize" type="text" value="" />
    </p>
    <p><a href="javascript:GalleryTiny.insert(GalleryTiny.e)">Create Shortcode</a></p>
</form>
</body>
</html>

share|improve this question
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.