Skip to content

Instantly share code, notes, and snippets.

<?php if(get_post_meta($post->ID, "video_embed", $single = true) != ""){ ?>
<div class="video"><?php echo get_post_meta($post->ID, "video_embed", TRUE); ?></div>
<?php } else { ?>
<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_post_thumbnail('primary', array('class' => 'shadow')); ?></a>
<?php } ?>
@jamiemitchell
jamiemitchell / gist:7003931
Created October 16, 2013 07:26
Snippet for custom metabox
<?php
$test_radio = get_post_meta($post->ID, 'test_radio', true);
if ($test_radio == 'yes')
echo 'Yes';
elseif ($test_radio == 'no')
echo 'No';
<?php
global $post;
$text = get_post_meta( $post->ID, '_cmb_test_text', true );
echo $text;
?>
/**
* Show WP-PostRatings dislikes for a post
*
* For use with a +1 and -1 system
*
*/
function ac_get_post_dislikes() {
global $post;
<?php
function my_custom_coins_title($coinsTitle)
{
global $post;
$affiliation = get_post_meta($post->ID, 'affiliation', true);
$issue = get_post_meta($post->ID, 'issue', true);
$volume = get_post_meta($post->ID, 'volume', true);
$pub_date = get_post_meta($post->ID, 'pub_date', true);
function heat_twitter_card(){
$title = get_post_meta(get_queried_object_id(), 'Title', true);
$description = get_post_meta(get_queried_object_id(), 'Description', true);
$image = get_the_image(array('format'=>'array')); ?>
<!--Twitter Card-->
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@marcheatley">
<?php
// print the blog thumbnail
function print_blog_thumbnail( $post_id, $item_size ) {
if( empty($item_size) ){ return ''; }
$thumbnail_types = get_post_meta( $post_id, 'post-option-thumbnail-types', true);
if( $thumbnail_types == "Image" || empty($thumbnail_types) ){
$thumbnail_id = get_post_thumbnail_id( $post_id );
$thumbnail = wp_get_attachment_image_src( $thumbnail_id , $item_size );
$alt_text = get_post_meta($thumbnail_id , '_wp_attachment_image_alt', true);
<?php
/**
* Single Post
*
* @package BE_Genesis_Child
* @since 1.0.0
* @link https://github.com/billerickson/BE-Genesis-Child
* @author Bill Erickson <bill@billerickson.net>
* @copyright Copyright (c) 2011, Bill Erickson
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
<?php
/**
* Section Title
*
*/
function be_section_title() {
$section_info = array( 'title' => '', 'subtitle' => '', 'title_url' => '', 'subtitle_url' => '' );
<?php
/**
* Portfolio Archive
*
* @package BE_Genesis_Child
* @since 1.0.0
* @link https://github.com/billerickson/BE-Genesis-Child
* @author Bill Erickson <bill@billerickson.net>
* @copyright Copyright (c) 2011, Bill Erickson
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License