Created
November 14, 2016 15:42
-
-
Save anonymous/232ad6bebf6b3a1b3e6c2e5093e1be95 to your computer and use it in GitHub Desktop.
This file contains 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_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) && $video1 != '' ){ | |
echo '<h4>Video Gallery</h4>'; | |
echo '<div class="one-third first">'; | |
echo $video1; | |
echo '</div>'; | |
} | |
$video2 = get_field( 'video_two'); | |
if( isset($video2) && $video2 != '' ){ | |
echo '<div class="one-third">'; | |
$video2 = get_field( 'video_two'); | |
echo $video2; | |
echo '</div>'; | |
} | |
$video3 = get_field( 'video_three'); | |
if( isset($video3) && $video3 != '' ){ | |
echo '<div class="one-third">'; | |
$video3 = get_field( 'video_three'); | |
echo $video3; | |
echo '</div>'; | |
} | |
echo '<div class="clear"></div>'; | |
$gallery_id = get_field('nextgen_gallery_id'); | |
if( isset($gallery_id) && $gallery_id != '' ){ | |
echo '<h4>Image Gallery</h4>'; | |
echo "<div class=\"post-gallery\">"; | |
// echo nggShowGallery( $gallery_id ); // Display the gallery | |
echo do_shortcode( $gallery_id ); | |
echo "</div><div class='clear'></div>"; | |
} | |
echo '<div class="post"><h4>Topics</h4>'; | |
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('<div class="entry"><h4> ',', ','</h4></div>'); | |
echo '</div>'; | |
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); ?> | |
<div class="block"> | |
<div class="fix"></div> | |
<h2 class="cufon"><?php the_title(); ?></h2> | |
<?php the_excerpt(); ?> | |
<span class="more"><a>"><?php _e('More Info', 'woothemes') ?></a></span> | |
</div> | |
<?php endforeach; ?> | |
<div class="fix"></div> | |
<?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