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
<?php | |
// Layout Option: Table via Tablepress | |
// Init Post Object | |
$postobject = get_sub_field('table'); | |
$post = $postobject; | |
setup_postdata( $post ); | |
// tablepress plugin query / args | |
// get ACF saved data. |
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
<?php | |
// get the count on the repeater field | |
// mabye use get_sub_field() instead of get_field() if it's nested | |
$count = count( get_sub_field( 'the_field' ) ); | |
// begin $count conditions | |
if ( $count > 1 ) { ?> | |
// greater than 1 | |
<?php the_field( 'great_than_1' ); ?> | |
<?php } else { ?> |
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
<?php if( have_rows('images') ): ?> | |
<div class="container"> | |
<div class="row"> | |
<section class="image-row"> | |
<div class="color-wrap"> | |
<?php while ( have_rows('images') ) : the_row(); ?> | |
<div class="half" style="background-color:<?php the_sub_field('background_color'); ?>"></div> | |
<?php endwhile; ?> | |
</div> |
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
<?php if(get_sub_field('accordion_section')) : $i = 0; ?> | |
<section class="panels-wrapper"> | |
<?php while(has_sub_field('accordion_section')) : $i++; ?> | |
<div class="panel-group" id="accordion"> | |
<div class="panel panel-default"> | |
<div class="panel-heading"> | |
<div class="panel-title"> | |
<?php | |
// panel link conditions |
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
<?php | |
// Two Column Repeater to hold Left / Right Flexible Content Fields | |
if( have_rows('two_col_row') ): while ( have_rows('two_col_row') ) : the_row(); ?> | |
<?php | |
// left col flexible content | |
while(has_sub_field("left_column")): ?> | |
<?php if(get_row_layout() == "body_copy"): // layout: Content ?> | |
<?php the_sub_field('title'); ?> | |
<?php the_sub_field('body_copy'); ?> |
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
<?php | |
// get all the categories from the database | |
$cats = get_categories(); | |
// loop through the categries | |
foreach ($cats as $cat) { | |
// setup the cateogory ID | |
$cat_id= $cat->term_id; ?> | |
<h2><?php echo $cat->name ?></h2> |
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
<?php | |
// post tags | |
$posttags = get_the_tags(); | |
if ($posttags) { | |
$taglist = ""; ?> | |
<ul class="tags"> | |
<div class="title">Tags</div> | |
<?php foreach($posttags as $tag) { | |
$taglist .= '<a href="'. get_tag_link($tag->term_id) .'">' . $tag->name . '</a>, '; | |
} echo rtrim($taglist, ", "); } ?> |
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
<?php | |
// If the page has Flexible Content: | |
if(get_field('flexible_main_content')) : | |
$rows = get_field('flexible_main_content'); | |
// Get the first instance of the Body Copy field | |
foreach( array_slice($rows, 0, 1) as $row ) { | |
$excerpt = $row['body_copy']; | |
echo '<p>' . trunc($excerpt, 15) . '</p>'; | |
} | |
// Otherwise get the content |
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
// Limit Word Count, Strip Tags from Result | |
function trunc($phrase, $max_words) { | |
$phrase_array = explode(' ',strip_tags($phrase)); | |
if(count($phrase_array) > $max_words && $max_words > 0) | |
; | |
$phrase = implode(' ',array_slice($phrase_array, 0, $max_words)).'...'; | |
return $phrase; | |
} |
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
<?php | |
$terms = get_the_term_list( $post->ID, 'project status' ); | |
echo $terms = strip_tags( $terms ); | |
?> |