Skip to content

Instantly share code, notes, and snippets.

@duogeekdev
duogeekdev / code.php
Last active January 23, 2017 19:34
Add featured image in rss feed in a wordpress site
<?php
function add_featured_image_in_rss() {
if ( function_exists( 'get_the_image' ) && ( $featured_image = get_the_image('format=array&echo=0') ) ) {
$featured_image[0] = $featured_image['url'];
} elseif ( function_exists( 'has_post_thumbnail' ) and has_post_thumbnail() ) {
$featured_image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'post-thumbnail' );
} elseif ( function_exists( 'get_post_thumbnail_src' ) ) {
$featured_image = get_post_thumbnail_src();
@duogeekdev
duogeekdev / hide-admin-bar-in-wordpress.php
Created February 26, 2015 13:33
Hide admin bar in WordPress
<?php
// Simple way
add_filter( 'show_admin_bar', '__return_false' );
// Standard way
add_filter( 'show_admin_bar', 'show_admin_bar_cb' );
function show_admin_bar_cb() {
return false;
}
@duogeekdev
duogeekdev / my-mu-plugin.php
Created February 25, 2015 16:11
mu-plugins sample
<?php
function do_something() {
// Here we are doing something
}
function do_another_thing() {
$some_variable = do_something();
// Here we are doing another thing
}