Articles of plugin development

Resizing Images for a Gallery-Plugin?

I’m currently working on a gallery plugin similar to the one found on Posterous. I’m needing all images in the gallery in a very small thumbnail-size. Probably only 50px wide. What’s the best practice to implement the image resizing? 1.) Adding the Image size via add_image_size()? This method has the obvious disadvantage, that all previously […]

WP_Query returns no results

I’m using wp_query to create a custom query that retrieves search results but it is returning 0 results. Here is the code: $query = ‘s=the&posts_per_page=5&paged=1′; $custom_query = new WP_Query(); $custom_query->query($query); if( $custom_query->have_posts() ) { while ( $custom_query->have_posts() ) : $custom_query->the_post(); $this->get_article(); endwhile; } else $this->posts_404(); When I search for the word ‘the’ through the search […]

Sidebar widget to show popular post not working?

This is the code to display popular post on front end, however the problem is the data is not saving from the back end. Like i want to show only 3 popular posts on front-end so i select the option 3 but its not saving. However when i pass the static value for $popularpostcount then […]

like to keep reading plugin

I am using the like to keep reading plugin. I have created some code in index.html file. I use this code [like_to_read] some code here [/like_to_read] That is not working. But if I use in this in a post it will work like a charm. I, however, want to use in index.html. How can I […]

How to append text to title of Custom Post Type post (without affecting all titles on page)?

This question ‘How to correctly get post type in a the_title filter’ is exactly what I’m trying to achieve. I have set a filter as below but it affects all titles on the page (in the menu, sidebar and footer) rather than just the post title. Apparently I need to use the add_filter just before […]

How to trigger an action with a URL

I am writing a plugin that needs to trigger an action based on URL’s. The url scheme is the following: mywordpresssite.com/action/12345 where 12345 is a unique code used by the function triggered. My question is how can I trigger a function in the plugin based on such a link? EDIT Thanks to the answers below […]

Show add_meta_box by selecting a specific category

In my plugin I want to display an add_meta_box under the WYSISWYG in the new post page, which is no problem and works fine. But the box should only appear when a specific category (example: category with id = 5) is selected, otherwise it is not visible. How can this be achieved? Edit as requested […]

Which themes do you use to test compatibilities with your plugin

When developing a plugin, I usually test it with the following themes before public release: TwentyTen by Automattic TwentyEleven by Automattic Coraline by Automattic Duster by Automattic Hybrid by Justin Tadlock News by Justin Tadlock Prototype by Justin Tadlock Retro-fitted by Justin Tadlock Responsive by ThemeID PageLines by PageLines Buttercream by Caroline Moore Catch Box […]

Avoiding Duplicate function names in Post Loop (WP_Footer script)

Say I created a plugin that injects content (used as a shortcode) into a post. I’m trying to push that code for each post to the bottom of the page. This works fine, however when you are on an archive page with multiple posts using the same shortcode, there is an obvious conflict because the […]

jquery document ready function not being called

For some reason I can’t get the jquery document ready to fire for my plugin my javascript jquery(document).ready(function($) { alert(“hello world”); $(“#testdiv”).text(“hi”); }); the source from my website <link rel=’stylesheet’ id=’admin-bar-css’ href=’http://example.com/wp-includes/css/admin-bar.css?ver=20111209′ type=’text/css’ media=’all’ /> <script type=’text/javascript’ src=’http://example.com/wp-includes/js/jquery/jquery.js?ver=1.7.1′></script> <script type=’text/javascript’> /* <![CDATA[ */ var fantasy_golf = {“ajaxurl”:”http:\/\/example.com\/wp-admin\/admin-ajax.php”}; /* ]]> */ </script> <script type=’text/javascript’ src=’http://example.com/wp-content/plugins/fantasy-golf/js/fantasy-golf.js?ver=1.2′></script> <script […]