This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Code for Adding Twitter Cards | |
add_action('wp_head', 'add_twitter_cards'); | |
function add_twitter_cards() { | |
if(is_single()) { | |
$tc_url = get_permalink(); | |
$tc_title = get_the_title(); | |
$tc_description = get_the_excerpt(); | |
$tc_image = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), full ); | |
$tc_image_thumb = $tc_image[0]; | |
$tc_author = str_replace('@', '', get_the_author_meta('twitter')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Customize Lists in Recent Posts Widget | |
class Genesis_Widget_Recent_Posts extends WP_Widget { | |
function __construct() { | |
$widget_ops = array('classname' => 'widget_recent_entries', 'description' => __( "The most recent posts on your site") ); | |
parent::__construct('recent-posts', __('Recent Posts'), $widget_ops); | |
$this->alt_option_name = 'widget_recent_entries'; | |
add_action( 'save_post', array($this, 'flush_widget_cache') ); | |
add_action( 'deleted_post', array($this, 'flush_widget_cache') ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//* Populate Similar Posts | |
function related_posts_categories() { | |
if ( is_single ( ) ) { | |
global $post; $count = 0; $postIDs = array( $post->ID ); $related = ''; $cats = wp_get_post_categories( $post->ID ); | |
$catIDs = array( );{ | |
foreach ( $cats as $cat ) { | |
$catIDs[] = $cat; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//* Display Related Post After Entry Content (blog post) | |
add_action( 'genesis_after_entry_content', 'related_posts_categories' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('get_the_content_limit_allowedtags', 'genesiswp_custom_allowedtags'); | |
function genesiswp_custom_allowedtags() { | |
return '<script>,<style>,<b>,<br>,<em>'; //add whatever tags you want to this string | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function the_content_limit($max_char, $more_link_text = '(more...)', $stripteaser = 0, $more_file = '') { | |
$content = get_the_content($more_link_text, $stripteaser, $more_file); | |
// remove shortcode | |
$content = preg_replace("/\/", '', $content); | |
// short codes are applied | |
$content = apply_filters('the_content', $content); | |
$content = str_replace(']]>', ']]>', $content); | |
$content = strip_tags($content,' | |
,<b>,<strong>,<a>,<i>, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//* Remove content/sidebar layout | |
genesis_unregister_layout( 'content-sidebar' ); | |
//* Remove sidebar/content layout | |
genesis_unregister_layout( 'sidebar-content' ); | |
//* Remove content/sidebar/sidebar layout | |
genesis_unregister_layout( 'content-sidebar-sidebar' ); | |
//* Remove sidebar/sidebar/content layout |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//* Grid Style Content Archive | |
function be_archive_post_class( $classes ) { | |
// Don't run on single posts or pages | |
if( !is_home() ) | |
return $classes; | |
$classes[] = 'one-half'; | |
global $wp_query; | |
if( 0 == $wp_query->current_post || 0 == $wp_query->current_post % 2 ) | |
$classes[] = 'first'; | |
return $classes; |