Skip to content

Instantly share code, notes, and snippets.

@pradeepdotco
pradeepdotco / functions.php
Last active May 26, 2022 23:41
Add Featured Image Genesis
/* Code to Display Featured Image on top of the post */
add_action( 'genesis_before_entry', 'featured_post_image', 8 );
function featured_post_image() {
if ( ! is_singular( 'post' ) ) return;
the_post_thumbnail('post-image');
}
//* Add new featured image sizes
add_image_size( 'home-bottom', 150, 100, TRUE );
add_image_size( 'home-top', 400, 200, TRUE );
@pradeepdotco
pradeepdotco / index.html
Created August 21, 2015 17:42
CSS inline
<html>
<head>
<title> Learning CSS for WordPress </title>
</head>
<body style="background-color: green;">
<header>
<span>Adding Inline CSS in a Document</span>
<h1 style="color: white">Inline CSS in a Document</h1>
@pradeepdotco
pradeepdotco / rssfeedimage.php
Created October 3, 2015 10:54
Function to add featured image to RSS feed
<?php
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;
}
}
[gist https://gist.github.com/pradeepdotco/761c6bc617b53ea6fc38 /]
[gist]761c6bc617b53ea6fc38[/gist]
[gist id="761c6bc617b53ea6fc38"]
[gist id="9b1307f153f4abe352a4" file="media-control-snippet.php"]
[gist id="9b1307f153f4abe352a4" file="media-control-snippet.php" lines="2-5"]
[gist id="9b1307f153f4abe352a4" file="media-control-snippet.php" highlight="7"]