Articles of javascript

prettyPhoto media loading very slowly in Chrome

I’m having a problem with prettyPhoto media WordPress plugin (lightbox type) script in Chrome. It works beautifully in other browsers, but it takes forever to load in Chrome. When using this script it is supposed to show the thumbs on the bottom of the lightbox effect, but it only works if I select “IE 6 […]

Display the number of unseen comments on a page since the user last visit

The community is private and it has several pages /wordpress /design /etc . When users go to those pages the only thing they can do is to comment. Now, what I am trying to do, Idk if possible, but if it is I need some directions/hints on what too search for. http://jsfiddle.net/melbourne/uPqBe/4/ Instead of those […]

Bridging TinyMCE js and WordPress PHP?

I’m updating my wordpress plugin to use a custom TinyMCE button. From inside the TinyMCE button javascript, I’d like to interact with wordpress data–ie set custom post options inside the plugin setting page, then access those values inside the TinyMCE js script. Can I invoke my php plugin functions from inside the TinyMCE button handler […]

How to load javascript file on homepage in WordPress in order?

I am using a quicktags plugin, which was not loading on the home page, now it does, but it does it on the wrong place. How can I solve this? I want the quicktags.min.js file to load first, rather than the basic-comment quicktags… I am using this script: add_action( ‘wp_enqueue_scripts’, ‘ron_scripts’ ); function ron_scripts(){ if(is_home()){ […]

wp-admin post.php JavaScript Links Not Working

I just recently noticed in my backend admin panel none of the dynamic JavaScript links will open or work at all. This includes the ‘Edit’ links next to Status, Visibility, and Scheduled. Also the slug permalink edit button will not do any Ajax/JavaScript. Clicking any of the links will just append the hashtag value (ex. […]

wpColorPicker: How update colors on input value update?

Setup: An input field that has attached a wpColorPicker instance. An external event that changes the input value color. Issues: On value change the color shown by the colorpicker doesn’t get automatically updated, neither the selection when user open up the colorpicker dialog box. wpColorPicker doesn’t have neitherremove, destroy nor update methods, so there is […]

JQuery not working in my plugin

This is my first time using JQuery in a WordPress plugin, and I’m having some trouble. Here is my “main” plugin document: <?php /* Plugin Name: Dump-It Scheduler Plugin URI: Description:Description Version: 1.0 Author: Blaine Anderson Author URI: http://www.blainevanderson.net License: */ add_action( ‘wp_enqueue_script’, ‘load_jquery’ ); add_action(‘wp_register_script’, ‘register_script’); add_action(‘wp_enqueue_script’, ‘run_js_script’); add_action(‘admin_menu’, ‘add_master_schedule’); add_action(‘admin_menu’, ‘add_customer_search’); add_action(‘admin_menu’, ‘add_edit_trucks’); […]

How to add comment on scripts using function in wordpress?

this is the code im using to call script if the browser is ie <!–[if IE]> <script src=”http://html5shiv.googlecode.com/svn/trunk/html5.js”></script> <style type=”text/css”> .clear { zoom: 1;display: block;} </style> <![endif]–> but how can i add this on function.php as normal way we do this to call the js wp_register_script(‘html5js’, (“http://html5shiv.googlecode.com/svn/trunk/html5.js”), false, ‘1.3.2’); wp_enqueue_script(‘html5js’); and i dont want to […]

How to get the post_name when in preview?

I’m using the below code in my functions.php file to include some JS only in posts I want. The code works fine for published posts and I can target a specific post, but how do I do it for posts that are not yet published, like viewing a draft post? global $post; if( is_page() || […]

WordPress Displaying Thumbnails Vertically

WordPress is displaying my thumbnails vertically and VERY LARGE. Specifically it’s displaying WooCommerce product page thumbnails vertically and VERY LARGE. Can’t seem to figure out why or what piece of code is responsible for this happening. I already went into WordPress settings > Media, and made sure thumbnail sizes were correct at 150×150. Also tried […]