Skip to content

Instantly share code, notes, and snippets.

@philJohnson
Last active September 30, 2015 04:16
Show Gist options
  • Save philJohnson/8cc36af64b77f0bcbffc to your computer and use it in GitHub Desktop.
Save philJohnson/8cc36af64b77f0bcbffc to your computer and use it in GitHub Desktop.
Content blocks example
<div class="quote-container">
<span class="quote"><?php the_sub_field('quote');?></span>
<?php $Path=$_SERVER['REQUEST_URI'];
$URI=get_site_url().$Path;
?>
<span class="share-link">
<a class="uppercase" href="https://www.facebook.com/sharer/sharer.php?u=<?PHP echo $URI;?>" rel="nofollow" target="delivery" onclick="return window.open('','delivery','toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,copyhistory=no,scrollbars=yes,width=780,height=700')">Share quote on facebook</a>
<a class="uppercase" href="https://twitter.com/home?status=<?php echo urlencode(get_sub_field('quote') . " - " . $URI); ?>" rel="nofollow" target="delivery" onclick="return window.open('','delivery','toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,copyhistory=no,scrollbars=yes,width=780,height=700')">Share quote on twitter</a>
</span>
</div>
while(have_rows("content_blocks")){
the_row();
switch (get_row_layout()){
case 'text':
get_template_part("template-parts/text");
break;
case 'quote':
get_template_part("template-parts/quote");
break;
case '2_columns':
get_template_part("template-parts/2column");
break;
case 'icon-text':
get_template_part("template-parts/image_text");
break;
}
}
<div class="grid-100 tablet-grid-100 mobile-grid-100"><?PHP the_sub_field("text"); ?></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment