Skip to content

Instantly share code, notes, and snippets.

@blickwert
Last active August 29, 2015 14:17
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 blickwert/ad01af4c2e664d2bd121 to your computer and use it in GitHub Desktop.
Save blickwert/ad01af4c2e664d2bd121 to your computer and use it in GitHub Desktop.
Genesis - ACF Field on Front_page (Before Content)
<?php /**
* Genesis Before Content
*
* @author David Wögerer
* @since 2.1.2
*
*/
add_action( 'genesis_before_content', 'widget_before_content' );
function widget_before_content() {
if ( is_front_page() ) { ?>
<aside class="column-3">
<?php $repeater_rows = get_field('repeater_pagelink');
$num = 0;
foreach ($repeater_rows as $repeater_row) {
$num++;
// var_dump($repeater_row);
$params = array( 'width' => 250, 'height' => 250, 'crop' => true );
$imageurl = wp_get_attachment_url ( $repeater_row['image_pagelink'] );
$imageurl = bfi_thumb( $imageurl, $params ); ?>
<a class="col<?php echo $num; ?>" style="background-image:url(<?php echo $imageurl; ?>);" href="<?php echo get_permalink( $repeater_row['url_pagelink'] ); ?>">
<div>
<span class="text1"><?php echo $repeater_row['text']; ?></span>
<span class="text2"><?php echo $repeater_row['text2']; ?></span>
</div>
</a>
<?php } ?>
</aside>
<?php }
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment