How to extend a plugin like we do a theme?

There’s no standard method apart from hooks, and it’s up to the developer of the original plugin to add and support these. If the plugin is extendable they will have developer documentation (LearnDash’s is available here). The specifics will depend entirely on the plugin and how they’ve chosen to allow it.

Custom Post Type Statuses

Custom post statuses do exist in the core code of WordPress, so you can register them, but they are not yet properly implemented in the admin screens (e.g. they don’t show in the dropdown list of statuses alongside Pending Review, Draft, Published). So essentially you can do very little with them at the moment. You … Read more

How to get an image transferred via FTP or script to appear in Media Manager?

add this to your for each and $filename to each file, $wp_filetype = wp_check_filetype(basename($filename), null ); $attachment = array( ‘post_mime_type’ => $wp_filetype[‘type’], ‘post_title’ => preg_replace(‘/\.[^.]+$/’, ”, basename($filename)), ‘post_content’ => ”, ‘post_status’ => ‘inherit’ ); $attach_id = wp_insert_attachment( $attachment, $filename, 0 ); // you must first include the image.php file // for the function wp_generate_attachment_metadata() to … Read more

WordPress select dropdown list in widget

See my comment above…you’re using get_field_id() on the name-attribute, where it should be get_field_name(). get_field_id() returns ‘widget-‘.$this->id_base.’-‘.$this->number.’-‘.$field_name, whereas get_field_name() returns ‘widget-‘.$this->id_base.'[‘ . $this->number . ‘][‘ . $field_name.’]’

PDF download – use wordpress functions

You should create a function in your plugin where you listen to a specific URL or watch for specific parameters. For example to generate the download link: <?php $nonce = wp_create_nonce( ‘download-‘ . $filename ); echo ‘<a href=”https://wordpress.stackexchange.com/?_wp_nonce=”‘ . $nonce . ‘&download=’ . $filename . ‘”>Some Download</a>’; ?> And to download the file: if ( … Read more

What is the function to get plugin base url in multisite?

The plugins_url() function is designed to work in WordPress Multisite. Here is an example of its proper usage: <?php echo “<img src=”‘ .plugins_url( ‘images/wordpress.png’ , __FILE__ ). ‘” > ‘; ?> If you are using this function in a file that is nested inside a subdirectory, you should use PHP’s dirname() function: <?php echo “<img … Read more