Cron Job not working in plugin

The cron event needs to be registered on the plugin activation hook like so: register_activation_hook( __FILE__, ‘activate_cron’ ); function activate_cron() { wp_schedule_event( current_time( ‘timestamp’ ), ‘hourly’, ‘the_function_to_run’ ); } The the_function_to_run defined in the wp_schedule_event needs to be your function that you want to run at the time interval. Note: When you say something is … Read more

background images WP Supersized on homepage

query_posts Avoid this function at all costs. The likely cause of your problem is queries not cleaning up after eachother. Your call to query_posts will have modified the main query ( wasting the original ), and messed up everything following it. Instead use WP_Query followed by wp_reset_postdata $query = new WP_Query(‘cat=17&posts_per_page=1&meta_key=FeaturedOnHomepage&meta_value=yes’); if($query->have_posts()){ while ($query->have_posts()) { … Read more

how to add text to posts from tags

There is no plugin for that… at least one plugin 🙂 Create custom fileds for your custom text. Install ACF plugin (advanced custom fields) from wordpress.org. Now… create a field group with ACF and then create custom fileds inside that group for your custom text 1 and custom text 2. (Don’t forget to assign field … Read more

plugin shortcode output

If you open the plugin file and find where the function add_shortcode(‘daisy’,’someotherfunction’); is, then you could simply call that function that the shortcode is pointing too. This code could be placed as follows in a plugin or the functions.php file of your theme: add_action( ‘admin_init’, ‘daisy_fun’ ); function daisy_fun(){ ?> <script type=”text/javascript” defer=”defer”> jQuery(document).ready(function(){ var … Read more

Plugin allowing users to add articles to a library

To keep track of each user’s favourite articles you could store the post IDs of the articles in the $wpdb->usermeta table with a simple plugin. Such a plugin would use the add_user_meta(), get_user_meta() and delete_user_meta() functions to store and retrieve the IDs to/from the database.