Skip to content

Instantly share code, notes, and snippets.

Created November 14, 2016 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/232ad6bebf6b3a1b3e6c2e5093e1be95 to your computer and use it in GitHub Desktop.
Save anonymous/232ad6bebf6b3a1b3e6c2e5093e1be95 to your computer and use it in GitHub Desktop.
add_action ('genesis_entry_content', 'etb_acf_posts' );
function etb_acf_posts() {
if (!is_singular(array('speakers','live_arts','event_production','films','presentations')) ) {
return;
}
// else
{
$bookinglink = get_field('booking_url');
echo '<a href="'.$bookinglink.'">';
$btntext = get_field('booking_button_text');
if ($btntext == '') {
echo 'Book ';
echo the_title();
} else {
echo $btntext; }
echo '</a>';
$video1 = get_field( 'video_one');
if( isset($video1) &amp;&amp; $video1 != '' ){
echo '&lt;h4&gt;Video Gallery&lt;/h4&gt;';
echo '&lt;div class="one-third first"&gt;';
echo $video1;
echo '&lt;/div&gt;';
}
$video2 = get_field( 'video_two');
if( isset($video2) &amp;&amp; $video2 != '' ){
echo '&lt;div class="one-third"&gt;';
$video2 = get_field( 'video_two');
echo $video2;
echo '&lt;/div&gt;';
}
$video3 = get_field( 'video_three');
if( isset($video3) &amp;&amp; $video3 != '' ){
echo '&lt;div class="one-third"&gt;';
$video3 = get_field( 'video_three');
echo $video3;
echo '&lt;/div&gt;';
}
echo '&lt;div class="clear"&gt;&lt;/div&gt;';
$gallery_id = get_field('nextgen_gallery_id');
if( isset($gallery_id) &amp;&amp; $gallery_id != '' ){
echo '&lt;h4&gt;Image Gallery&lt;/h4&gt;';
echo "&lt;div class=\"post-gallery\"&gt;";
// echo nggShowGallery( $gallery_id ); // Display the gallery
echo do_shortcode( $gallery_id );
echo "&lt;/div&gt;&lt;div class='clear'&gt;&lt;/div&gt;";
}
echo '&lt;div class="post"&gt;&lt;h4&gt;Topics&lt;/h4&gt;';
function mytheme_filter_tags( $term_links ) {
$result = array();
$exclude_tags = array( 'featured' );
foreach ( $term_links as $link ) {
foreach ( $exclude_tags as $tag ) {
if ( stripos( $link, $tag ) !== false ) continue 2;
}
$result[] = $link;
}
return $result;
}
add_filter( "term_links-post_tag", 'mytheme_filter_tags', 100, 1 );
echo get_the_tag_list('&lt;div class="entry"&gt;&lt;h4&gt; ',', ','&lt;/h4&gt;&lt;/div&gt;');
echo '&lt;/div&gt;';
remove_filter( "term_links-post_tag", 'mytheme_filter_tags', 100 );
}
//HERE IS THE PART I AM HAVING TROUBLE WITH
$posts = get_field('you_might_also_like');
if( $posts ):
foreach( $posts as $post): // variable must be called $post (IMPORTANT)
setup_postdata($post); ?&gt;
&lt;div class="block"&gt;
&lt;div class="fix"&gt;&lt;/div&gt;
&lt;h2 class="cufon"&gt;&lt;?php the_title(); ?&gt;&lt;/h2&gt;
&lt;?php the_excerpt(); ?&gt;
&lt;span class="more"&gt;<a>"&gt;&lt;?php _e('More Info', 'woothemes') ?&gt;</a>&lt;/span&gt;
&lt;/div&gt;
&lt;?php endforeach; ?&gt;
&lt;div class="fix"&gt;&lt;/div&gt;
&lt;?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly
endif;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment