Articles of plugin development

Adding option to Gallery shortcode

just starting out in WP dev, and I’m looking for any guidance I can get. What I’d like to do is use a hook or filter to add my own option to the core WP gallery shortcode. I would want it to work just like the standard ‘exclude’ option, but still show those images for […]

Conditional hook based on the core function that is calling it

In a Multisite, I’m applying the filter get_blogs_of_user to sort the “My Sites” admin bar menu, where the sites are listed by blogname: What happens is that I’d like another order elsewhere, where the sites are listed by domain. For example, the sites that appear in the Users screen (/wp-admin/network/users.php): The question is: for achieving […]

WordPress Search filter to remove possible script injections

I am trying to write a short plugin that will filter html characters from the search form. In the event someone enters in <script>alert(‘some infectious js!’);</script> into the search form i want to remove the possibility of this command to be entered into the search form. I tried this: function SearchFilter( $query ) { if […]

Script won't load via plugin class

I’m not sure why this script is not loading or producing any load errors via Firebug. Here is my plugin script: class AV_Slideshow{ function __construct(){ $this->hooks(); } function hooks(){ add_action(‘wp_head’, array( $this, ‘load_av_slider’ )); } function load_av_slider(){ wp_register_script(‘av-slideshow’, get_bloginfo(‘stylesheet_directory’) . ‘/js/AV-Slideshow/av_slideshow.js’, array(‘jquery’) ); wp_enqueue_script(‘av-slideshow’ ); } function build_slideshow($slides){ if(!$slides){$slideshow = ‘No posts are selected for […]

Plugin menu addition in multisite

$wp_admin_bar->add_menu( array( ‘parent’ => $menu_id, ‘id’ => $menu_id . ‘-example’, ‘title’ => __( ‘Example Menu Item’, ‘example’ ), ‘href’ => get_admin_url( $blog->userblog_id, ‘edit.php?post_type=example’ ), ) ); Lets say i have a plugin that add a new menu item for an example custom post type to blog menu. Problem is if i have lots of blogs […]

Get name and email of current unregistered user, who has recently submitted name and email in comment form?

From within a WordPress plugin, is there any way to get the name and email of the current user, when s/he is not logged in, but has recently submitted a comment, and specified name and email in the comment reply form? Or is the name & email only available during the HTTP request in which […]

How to modify product page for Jigoshop

Hi I am editing Jigoshop loop-shop.php to create a customize look list and the code is below …. Please do let me know where I can get below things … Add to Cart – Link Only Price Text – List item and Product Description Below is my code of loop-shop.php <?php global $columns, $per_page; do_action(‘jigoshop_before_shop_loop’); […]

Adding (blog-specific) links to “My Sites” admin page

The My Sites admin page only has links to the sites’ dashboards and production pages which is of limited value. I am trying to figure out a way to add a more useful links to them like New Post, Drafts, and Comments in order to make the page a practical central administration location (that way, […]

How to save post change url youtube link?

In functions.php i using this to change width url from youtube: add_action(‘save_post’, ‘set_url_youtube’); function set_url_youtube() { $post = get_post($post_id); $content = $post->post_content; preg_match_all(‘#([-|~_0-9A-Za-z]+)|watch\?v\=([-|~_0-9A-Za-z]+)&?.*?)#i’, $content, $urls, PREG_SET_ORDER); if(is_array($urls)) { foreach ($urls as $url) $videos_url[] = $url[0]; } if (is_array($videos_url)) { $videos_url = array_unique($videos_url); rsort($videos_url); } if($videos_url) { foreach ($videos_url as $video_url) { $content = str_replace($video_url, $video_url.’&w=550′, […]

Best approach to fetch data from wp options to js file or php file

I am creating my first ever plugin, as I am not a programmer, I have been following tutorials and reading the codex, etc. My plugin consist in showing a notice to users when certain conditions are met, I have written it in jQuery and placed it in a js file which is enqueued by the […]