Exclude Specific Categories from RSS Feed

/** * Exclude a category or multiple categories from the feeds. * If you want to exclude multiple categories, use a comma-separated list: “-15, -5, -6”. * Make sure to prefix the category id(s) with a minus “-“. * *…Continue reading

Display the Last Updated Date

$u_time = get_the_time( ‘U’ ); $u_modified_time = get_the_modified_time( ‘U’ ); // Only display modified date if 24hrs have passed since the post was published. if ( $u_modified_time >= $u_time + 86400 ) { $updated_date = get_the_modified_time( ‘F jS, Y’ );…Continue reading

Set oEmbed Max Width

function wpcode_snippet_oembed_defaults( $sizes ) { return array( ‘width’ => 400, ‘height’ => 280, ); } add_filter( ’embed_defaults’, ‘wpcode_snippet_oembed_defaults’ );Continue reading

Set a Minimum Word Count for Posts

/** * Prevent publishing posts under a minimum number of words. * * @param int $post_id The id of the post. * @param WP_Post $post The post object. * * @return void */ function wpcode_snippet_publish_min_words( $post_id, $post ) { //…Continue reading

Add the Page Slug to Body Class

function wpcode_snippet_add_slug_body_class( $classes ) { global $post; if ( isset( $post ) ) { $classes[] = $post->post_type . ‘-‘ . $post->post_name; } return $classes; } add_filter( ‘body_class’, ‘wpcode_snippet_add_slug_body_class’ );Continue reading