$post->ID not working

Your WP_Query loop is incomplete. Your not checking if any posts were actually found before looping, nor are you presenting a message to show none were found, nor are you cleaning up afterwards. You’re also using the ‘other’ syntax that breaks brace matching in IDEs, making your life harder. Try adding global $post; like this: … Read more

how to create cron that post events daily in wordpress?

WordPress has a cron API and if you want to use it you can do it with wp_schedule_event function. This function should be called only on ativiation of the plugin and the scheduled event should be cleared on deactivation of the plugin. For example: register_activation_hook( __FILE__, ‘cyb_activation’ ); function cyb_activation() { wp_schedule_event( time(), ‘daily’, ‘cyb_daily_event_hook’ … Read more

Shortcode for printing post titles

I know this has been answered and the answer solved the issue but I found it very poor for any newbie that want to learn WordPress so I give mine in the hope it will be better: While get_posts() can do the job I would have used a simple query, for a secondary loop I … Read more

Grab next post title in archive page

This doesn’t seem terribly efficient but you could just look up the next/prev posts in the loop used to display the post then output the post titles in the nav calls. // loop if ( have_posts() ) : while ( have_posts() ) : the_post(); // … post display // next & prev post data $older … Read more