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

WordPress custom styles in menu page

You could use <!doctype html> <head> <style type=”text/css”> #toplevel_page_custom_menu_title{ display:none !important; } .update-nag{ height:auto !important; } </style> </head> <body> <div class=”update-nag”> <?php echo “Admin Page Test”; ?> </div> </body> </html> You can enqueue this way function prefix_add_my_stylesheet() { wp_register_style( ‘prefix-style’, plugins_url(‘style.css’, __FILE__) ); wp_enqueue_style( ‘prefix-style’ ); } add_action( ‘admin_enqueue_scripts’, ‘prefix_add_my_stylesheet’ ); Reference: http://codex.wordpress.org/Plugin_API/Action_Reference/admin_enqueue_scripts#Example:_Load_CSS_File_on_All_Admin_Pages

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