How do I email a new page password to somebody every month?

First of all, you should wrap your cron into a method: function cronjob_once_every_month() { // Our custom cron interval: $schedules[‘every_month’] = array( ‘interval’ => 1 * MONTH_IN_SECONDS, ‘display’ => ‘Once every Month’ ); } a) set up an automated email Then you should schedule an action: if ( ! wp_next_scheduled( ‘cronjob_once_every_month’ ) ) { wp_schedule_event( … Read more

wordpress plugin error handling

WordPress have WP_Error class for checking WordPress errors and error messages since version 2.1.0. WordPress use object of WP_Error class for reporting error from several WP function. However, we can use this object in plugin or theme to handle error within WordPress. This class containing verious useful method for managing error. All methods <?php //Creating … Read more

Handling jQuery Component Collision

My suggestion would be to use a mix of code isolation in an anonymous function and checking if jquery is already present. Here’s an example: (function() { var jQuery; // your jquery variable // check if jquery is present and if it has the version you want if (window.jQuery === undefined || window.jQuery.fn.jquery !== ‘1.8.3’) … Read more

Upload file to remote storage

Two options: Hook into ‘wp_handle_upload’, a filter provided by the function wp_handle_upload() in wp-admin/includes/file.php: apply_filters( ‘wp_handle_upload’, array( ‘file’ => $new_file, ‘url’ => $url, ‘type’ => $type ), ‘upload’ ) Replace the new file URI with your remote URI. The function wp_insert_attachment() in wp-includes/post.php offers two actions: do_action(‘edit_attachment’, $post_ID); do_action(‘add_attachment’, $post_ID); You can get the attachment … Read more

how to use thickbox in admin?

Below, an example of what’s needed to use ThickBox. <?php wp_enqueue_style(‘thickbox’); wp_enqueue_script(‘thickbox’); ?> <a href=”#” id=”taxonomy_banner_image” class=”taxonomy_banner_image”> Click Here </a> <script type=”text/javascript”> jQuery(document).ready(function() { jQuery(“#taxonomy_banner_image”).click(function() { tb_show(“”, “filename?TB_iframe=true”); return false; }); }); </script> tb_show parameters: title of the box. url of file and with parameter iframe=true I think this will give you an idea how … Read more

Changing upload directory for plugin uploads only

There must be something identifiable about your form data, such as your input names. Check for one or more of those and process accordingly. function custom_upload_dir($args) { if (isset($_POST[‘something’])) { $args[‘path’] = $args[‘basedir’] . “/mypath” . $args[‘subdir’]; $args[‘url’] = $args[‘baseurl’] . “/mypath” . $args[‘subdir’]; } return $args; } After some investigation, the only things I … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)