Skip to content

Instantly share code, notes, and snippets.

@jamiemitchell
jamiemitchell / gist:7002633
Last active December 25, 2015 15:59 — forked from envex/gist:485558
<?php
$key = get_post_meta($post->ID, 'your-key', true) ? get_post_meta($post->ID, 'your-key', true) : 'No Key, try again!';
echo $key;
<?php
if( get_post_meta( get_the_ID(), 'diww_sponsored', true ) == 'sponsored' ) {
if( get_post_meta( get_the_ID(), 'diww_sponsored_type', true ) == 'giveaway' ) {
$sponsored_content = '<p class="sponsored">This is a sponsored giveaway.</p>';
$sponsored_content .= $content;
return $sponsored_content;
}
if( get_post_meta( get_the_ID(), 'diww_sponsored_type', true ) == 'review' ) {
$sponsored_content = '<p class="sponsored">This is a sponsored review.</p>';
<?php
$contact_name = get_post_meta(get_the_ID(), 'secondary-contact-name', true);
if(!empty($contact_name)):
?>
<dt>Secondary contact</dt>
<dd><?php echo apply_filters('the_content', $contact_name); ?></dd>
<dd><?php echo apply_filters('the_content', get_post_meta(get_the_ID(), 'secondary-contact-phone', true)); ?></dd>
<?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 } ?>
<?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);