Articles of plugin development

Add a row on clicking each post featured image

I have to add a row that (containing the content of post) below the post thumbnail on clicking thumbnail. I have done it by using this but it affects the adjacent post thumbnail.I want that a complete row to be add below every post without affecting other posts. Thumbnail of each post should be remain […]

Should shorcodes in i18n plugins be translated and if so, how?

Internationalizing a plugin with half a dozen shortcodes like: function plugin_show_schedule( $atts, ) { extract( shortcode_atts( array( ‘type’ => __(‘week’, ‘mz-mindbody-api’) ), $atts ) ); //Do stuff return $something; } add_shortcode(‘plugin-show-schedule’, ‘plugin_show_schedule’); And found an article describing some ways to translate shortcodes like this: function plugin_show_schedule( $atts, ) { extract( shortcode_atts( array( __(‘type’, ‘my-plugin’) => […]

Adding dynamic section to WordPress

[Edit: I’ve added a more concrete example below] I need to convert a custom PHP site to WordPress. The site has 60,000+ media items along with a ton of metadata, all of which needs to carry over to the new site. The media data is accessed via a local API and I’ve already figured out […]

Featured Image not showing in admin

Currently im making new theme and had the idea of adding featured image in the admin side of wordpress, unfortunately its not working this is what i have tried I have added this code in functions.php add_theme_support( ‘post-thumbnails’); i also tried to change it add_theme_support( ‘post-thumbnails’, array( ‘post’ ) ); // Add it for posts […]

Is it possible to sort metabox teaxtarea values?

Textarea is on an options page, is it possible to sort the values within that textarea by alpha? I looked in the Codex but do not see any mention of sorting these values.

Is there an action like 'after_register_custom_post_type'?

I’m writing a small plugin for Visual Composer. I need to list all custom post types but I don’t know when to call the query to fetch all post types. My plugin gets initialized by after_setup_theme, but the function which queries the custom post types don’t list custom post types, because its executed too early. […]

Shortcode display outside the div

I have created a shortcode that retrives and displays a form.The content of the attribute in HTML. function check_my_login( $atts) { return ‘<form action=”” name=”” method=”post” enctype=”multipart/form-data”> <div class=”form-group”> <label for=”description”>Project Description</label> <textarea name=”p_description” placeholder=”Project Description” class=”form-control”><?php if (isset($_POST[‘p_description’]) && $_POST[‘p_description’] != ”) echo $_POST[‘p_description’] ?></textarea> </div> <div class=”form-group”> <label>Project Attachment</label> <input type=”file” name=”p_attachment”> </div> […]

Namespaced action and filter tags

I’m upgrading several of my plugins to use PHP namespaces, so that functions, classes, constants etc are all namespaced correctly. <?php namespace my\plugin; function init() { … } // Calls \my\plugin\init(); add_action(‘init’, __NAMESPACE__.’\init’); In several places my plugin calls do_action or apply_filters so that other plugins can modify its behaviour. If these are actions or […]

Get all options saved by another plugin

I’m developing a plug-in that adds the possibility to import/export settings from another plug-in. However, I don’t have access to the options ids saved by that plug-in. Is it possible to get all options saved by a specific plug-in? What I would like is something like this: get_plugin_options($pluginId); // returns all options ids in a […]

Best practice for creating a custom archive template for a custom taxonomy which works on all themes?

I’m making a plugin which includes a custom post type with custom taxonomies. I have a custom template – taxonomy-coupon-category.php – but these template files are specific to a single theme. What is the best practice to make my plugin include a custom taxonomy/archive template which works for ALL themes? My custom code only needs […]