$post>ID displays wrong post ID

If i understand correctly you are trying to display a list of child pages of a page in a widget, if so then first check if you are on a page using the conditional tag is_page() then you can use $wp_query->get_queried_object_id() like t31os has pointed out so your widget display function should look like this: … Read more

How to publish a post with empty title and empty content?

If the post content, title and excerpt are empty WordPress will prevent the insertion of the post. You can trick WordPress by first filtering the input array so empty values are set to something else, and then later resetting these values back to empty strings. This will bypass the standard check. add_filter(‘pre_post_title’, ‘wpse28021_mask_empty’); add_filter(‘pre_post_content’, ‘wpse28021_mask_empty’); … Read more

How to remove Nextpage tag inside posts text depending of utm_campaign

You can use the_post hook to remove <!–nextpage–>. In this case: add_action( ‘the_post’, ‘campaign_remove_nextpage’, 99); function campaign_remove_nextpage ( $post ) { if ( ($_GET[‘utm_campaign’]== ‘nonextpagecampaign’) && (false !== strpos( $post->post_content, ‘<!–nextpage–>’ )) ) { // Reset the global $pages: $GLOBALS[‘pages’] = [ $post->post_content ]; // Reset the global $numpages: $GLOBALS[‘numpages’] = 0; // Reset the … Read more

order posts by date like craigslist

You may notice that I did more or less exactly this for Matt’s site: http://ma.tt. Every set of posts is grouped by the day. The basic principle is to keep track of your day in the loop, then print the date and related stuff only when it changes. Take a basic Loop: if ( have_posts() … Read more

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