How To Add Featured Image To RSS Feed In WordPress
Using the following snippet, you will be able to add featured image to RSS feed in WordPress.
1 2 3 4 5 6 7 8 9 10 11 |
add_filter( 'the_content', 'featured_image_in_feed' ); function featured_image_in_feed( $content ) { global $post; if( is_feed() ) { if ( has_post_thumbnail( $post->ID ) ){ $output = get_the_post_thumbnail( $post->ID, 'medium', array( 'style' => 'float:right; margin:0 0 10px 10px;' ) ); $content = $output . $content; } } return $content; } |
Snippet Source/Credit: WPSnipp
How To Add Nofollow Attribute To Category Specific Links In WordPress
Using the following snippet, you will be able to add nofollow attribute to category specific links in WordPress.
1 2 3 4 5 6 7 8 |
function nofollow_cat_posts($text) { global $post; if( in_category(1) ) { // SET CATEGORY ID HERE $text = stripslashes(wp_rel_nofollow($text)); } return $text; } add_filter('the_content', 'nofollow_cat_posts'); |
Snippet Source/Credit: WPRecipes
Get Parent Id For WordPress
Using the following snippet, you will be able to get Parent Id for WordPress.
1 2 3 4 5 6 7 |
<?php //get parent id $current_cat_id = get_query_var('cat'); $child = get_category($current_cat_id); $parent = $child->parent; // ?> |
Snippet Source/Credit: Snipplr
How To Remove Widgets From WordPress Dashboard
Using the following snippet, you will be able to remove widgets from WordPress dashboard.
1 2 3 4 5 6 7 |
//Remove unwanted widgets from Dashboard function remove_dashboard_widgets() { global$wp_meta_boxes; unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']); unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']); } add_action('wp_dashboard_setup', 'remove_dashboard_widgets'); |
Snippet Source/Credit: WP Guru
How To Replace ‘Howdy, Admin’ In WordPress With Something Else
The following snippet will let you replace “Howdy, Admin” in WordPress.
1 2 3 4 5 6 7 8 9 |
function replace_howdy( $wp_admin_bar ) { $my_account=$wp_admin_bar->get_node('my-account'); $newtitle = str_replace( 'Howdy,', 'Logged in as', $my_account->title ); $wp_admin_bar->add_node( array( 'id' => 'my-account', 'title' => $newtitle, ) ); } add_filter( 'admin_bar_menu', 'replace_howdy',25 ); |
Snippet Source/Credit: Snipplr