function mtm_output_url_override_sub($field1 = '', $field2 = 'mtm_post_content_link') { if (_get_sub_field($field1)) { $url = _get_sub_field($field1); } elseif (_get_sub_field($field2)) { $url = _get_sub_field($field2); } else { $url = ''; } return $url; }
</div> <?php } elseif ('Add Posts Manually' == get_sub_field('mtm_list_archive_select')) { // Post Type Source ?> <div class="mtm-module--list"> <?php if (_get_sub_field('mtm_show_taxonomy_links')) { mtm_terms_from_taxonomy_links(get_sub_field('mtm_list_archive_taxonomy_links')); // output taxonomy } $grid_posts = _get_sub_field('mtm_list_archive_manual_posts'); if ($grid_posts) { global $post; $org_post = $post; // save this in case we are inside a nested query/post object foreach ($grid_posts as $post) { // variable must be called $post (IMPORTANT) setup_postdata($post); mtm_get_template_part('mtm-content', 'list-view'); } $post = $org_post; // reset to original query } ?> </div>
?> "> <div class="mtm-home-featured--single-content"> <?php the_mtm_post_thumbnail('medium_large', 'mtm-home-featured--image'); ?> <div class="mtm-home-featured--single-text"> <h3 class="mtm-home-featured--single-title"><a href="<?php the_permalink(); ?> "> <?php if ("Post Title" == _get_sub_field('mtm_home_featured_box_title')) { the_title(); } else { esc_html(the_sub_field('mtm_home_featured_box_title')); } ?> </a></h3> <?php the_excerpt(); ?> </div> </div> </div>
<?php $image = _get_sub_field('mtm_list_item_image'); $url = mtm_output_url_override_sub('mtm_list_item_link'); $file = _get_sub_field('mtm_list_item_file'); $content_size = '-full'; ?> <article class="mtm-list--single"> <?php if ($image) { $content_size = ''; $thumb = $image['sizes']['medium_large']; $alt = $image['alt']; ?> <section class="mtm-list--image"> <figure class="post--thumbnail"> <?php if ($url) { ?> <a href="<?php echo esc_url($url); ?> "><?php } ?> <img src="<?php echo esc_url($thumb); ?>
/** * Shortcut for 'echo _get_sub_field()' * @param str $key The meta key Value to return if there's no value for the custom field $key * @return void * @uses _get_sub_field() */ function _the_sub_field($key, $default = '') { echo _get_sub_field($key, $default); }
<?php global $mtm_home_feature_count; ?> <div class="mtm-home-featured--single <?php echo mtm_count_classes($mtm_home_feature_count); ?> "> <div class="mtm-home-featured--single-content"> <?php $image = _get_sub_field('mtm_home_featured_image_manual'); $imageAlt = get_field('mtm_default_featured_image', 'option'); $url = mtm_output_url_override_sub('mtm_home_featured_content_link_manual', 'mtm_home_featured_content_link_custom'); if ($image) { $thumb = $image['sizes']['medium_large']; $alt = $image['alt']; ?> <a href="<?php echo esc_url($url); ?> "> <figure class="post--thumbnail mtm-home-featured--image"><img src="<?php echo esc_url($thumb); ?> " alt="<?php echo esc_html($alt); ?> " /></figure>
<?php // Featured Content Boxes Logic while (have_rows('mtm_home_featured_content_boxes')) { the_row(); // Loop through each item // Specific Content if ("Specific Content" == _get_sub_field('mtm_home_featured_type')) { $post_object = get_sub_field('mtm_home_featured_select_single'); if ($post_object) { $post = $post_object; setup_postdata($post); mtm_get_template_part('mtm-content', 'home-feature-select'); } // Show Latest Post } elseif ("Show Latest Post" == _get_sub_field('mtm_home_featured_type')) { $home_tax_query = mtm_taxonomy_query_sub('home_featured', 1); while ($home_tax_query->have_posts()) { $home_tax_query->the_post(); mtm_get_template_part('mtm-content', 'home-feature-select'); } // Manual Entry } else { mtm_get_template_part('mtm-content', 'home-feature-manual'); } ?> <?php }