WordPress.org

Ready to get started?Download WordPress

Forums

Sniplets
New post bug (4 posts)

  1. FolioVision
    Member
    Posted 3 years ago #

    Hello,

    the JS file for this plugin is not loaded when writing a new post. That makes the sniplets meta box and also rest of the inline JS non-functional.

    Please make sure to fix sniplets.php, line 150 from:

    if ( (isset($_GET['page']) && $_GET['page'] == 'sniplets.php') || strpos ($_SERVER['REQUEST_URI'], 'page.php') || strpos ($_SERVER['REQUEST_URI'], 'post.php')) {

    to:

    if ( (isset($_GET['page']) && $_GET['page'] == 'sniplets.php') || strpos ($_SERVER['REQUEST_URI'], 'page.php') || strpos ($_SERVER['REQUEST_URI'], 'post.php') || strpos ($_SERVER['REQUEST_URI'], 'post-new.php')) {

    That adds check for /wp-admin/post-new.php address and loads the required JS.

    Plugin version: 1.4.4, 1.4.5.

    Thanks,
    Martin

  2. kabeza
    Member
    Posted 2 years ago #

    Hi FolioVision
    I was looking for the same. I was having trouble inserting images into new posts, because the lightbox never worked, etc.

    I firebugged and discovered it was due to Sniplets.

    I'm using the 1.4.5 version and fixed the bug in the following lines: 250 and 258 (but nothing found at line #150)

    Thanks for the fix!

  3. 9steps
    Member
    Posted 2 years ago #

    Hi,

    I have the same problem on WP3.3 with Sniplets. I've tried the fix but does not work unfortunately.

    I suppose that jQuery and jQuery UI update on WP3.3 make this problem happened. Anyone knows how to fix this?

    Regards,

  4. MonkeyPress
    Member
    Posted 2 years ago #

    There are two fixes for this issue from what I've seen. One uses FolioVisions update as described above. WordPress changed the URL for new posts to "post-new.php". So that's one. Another change has to be made to the admin.js file in the resources folder of the Sniplets plugin.

    If you replace lines 231 to 239 with these line it'll get your edit page working. It won't however add in the sniplets button to your toolbar. I'm not sure what button the original developers code is trying to clone. Then again we have a new solution and won't require sniplets in our next site release.

    if (but) {
    		while (but.nodeType != 1)
    			but = but.previousSibling;
    
    		but = but.cloneNode (true);
    		toolbar.appendChild(but);
    		but.value = 'sniplet';
    		but.title = edButtons.length - 1;
    		but.onclick = function () {edInsertTag(edCanvas, parseInt(this.title));}
    		but.id = "ed_sniplet";
            }

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags