Skip to content

Instantly share code, notes, and snippets.

@SanjeevMohindra
SanjeevMohindra / function.php
Created October 29, 2013 17:54
Video Embed Shortcode for YouTube with Schema Markup
// YouTube ShortCode [youtube src="" title="" duration="" thumbnail="" description=""]
function youtube_shortcode( $atts ) {
extract(shortcode_atts(array(
'src' => '',
'title' => '',
'duration' => '',
'thumbnail' => '',
'description' => ''
), $atts));
$video_tag = '<div itemprop="video" itemscope itemtype="http://schema.org/VideoObject">';
@SanjeevMohindra
SanjeevMohindra / function.php
Created September 3, 2013 17:41
Remove Author Box For Selected CPT
function remove_author_box( $post_id ) {
// - Update the array for selected CPT, where you do not want to display the author box
$CPT = array('a'=>'Woocommerce', 'b'=>'WP Deals Engine');
// If this isn't a selected CPT post, don't update it.
if ( in_array ($_POST['post_type'], $CPT )) {
// - Update the post's metadata.
update_post_meta( $post_id, 'author_disp', 'NO');
}
}
add_action( 'save_post', 'remove_author_box');
@SanjeevMohindra
SanjeevMohindra / function.php
Created July 21, 2013 16:03
Correct the After Post Widget in Metro Child Theme with Genesis 2.0
add_action( 'genesis_entry_footer', 'metro_after_post' );
@SanjeevMohindra
SanjeevMohindra / function.php
Created July 21, 2013 15:43
Correct the Top Navigation in Metro theme with Genesis 2.0
// Adds widget area before the .menu on #subnav
add_filter( 'genesis_do_subnav', 'child_do_subnav_widget', 10, 2 );
function child_do_subnav_widget( $subnav_output, $subnav ){
ob_start();
genesis_widget_area( 'subnav-left', array(
'before' => '<div class="subnav-left widget-area">',
'after' => '</div>'
) );
$widget_area = ob_get_clean();
@SanjeevMohindra
SanjeevMohindra / function.php
Last active December 20, 2015 01:28
Enable Genesis 2.0 via Function.php
add_theme_support( 'html5' );