if (_get_field('mtm_show_taxonomy_links')) {
    mtm_terms_from_taxonomy_links($taxonomy);
    // output taxonomy links
}
?>

<?php 
if ($list_query->have_posts()) {
    ?>

	<div class="mtm-component--content mtm-list--wrapper">

		<?php 
    while ($list_query->have_posts()) {
        $list_query->the_post();
        mtm_get_template_part('mtm-content', 'list-view');
    }
    wp_reset_postdata();
    ?>

	</div>

<?php 
}
// end list_query
if ($view) {
    // View All Link
    ?>

	<a class="mtm-view-all-link" href="<?php 
    echo get_site_url() . '/' . $taxonomy . '/' . $terms;
<?php

// Call To Action
?>

<h2 class="h1"><?php 
the_title();
edit_post_link('(Edit)', ' • ');
?>
</h2>
<div <?php 
post_class('mtm-component--main');
?>
>
	<?php 
mtm_get_template_part('mtm-content', 'component-page');
?>
</div>
	
<?php 
mtm_get_template_part('mtm-content', 'call-to-action');
<?php

// Standard Component
?>

<h2 class="h1"><?php 
the_title();
edit_post_link('(Edit)', ' • ');
?>
</h2>
<div <?php 
post_class('mtm-component--main-full');
?>
>
		<?php 
mtm_get_template_part('mtm-content', 'component-page');
?>
</div>
<?php

// Featured News Story Logic
// Latest Post
if ("Latest Post" == _get_field('mtm_home_select_featured_story_source')) {
    $posttype = get_field('mtm_home_select_featured_story_type');
    $news_post_query = mtm_page_component_post_query($posttype, 1);
    while ($news_post_query->have_posts()) {
        $news_post_query->the_post();
        mtm_get_template_part('mtm-content', 'home-featured-story');
    }
    // Latest Taxonomy Post
} elseif ("Latest Post From Taxonomy" == _get_field('mtm_home_select_featured_story_source')) {
    $news_tax_query = mtm_taxonomy_query('home_featured_story', 1);
    while ($news_tax_query->have_posts()) {
        $news_tax_query->the_post();
        mtm_get_template_part('mtm-content', 'home-featured-story');
    }
    // Specific Post
} elseif ("Specific Post" == _get_field('mtm_home_select_featured_story_source')) {
    $post_object = get_field('mtm_home_featured_story_select_single');
    if ($post_object) {
        $post = $post_object;
        setup_postdata($post);
        mtm_get_template_part('mtm-content', 'home-featured-story');
    }
}
// List Archive
if ("List Archive" == _get_field('mtm_select_component')) {
    // Select a taxonomy to display list
    if ("Pick From Taxonomy" == _get_field('mtm_list_archive_select')) {
        mtm_get_template_part('mtm-component', 'taxonomy-list');
        // Manually pick posts to display list
    } else {
        mtm_get_template_part('mtm-component', 'manual-list');
    }
    // Grid Archive
} elseif ("Grid Archive" == _get_field('mtm_select_component')) {
    // Select a taxonomy to display grid
    if ("Pick From Taxonomy" == _get_field('mtm_grid_archive_select')) {
        mtm_get_template_part('mtm-component', 'taxonomy-grid');
        // Manually pick posts to display grid
    } else {
        mtm_get_template_part('mtm-component', 'manual-grid');
    }
    // Tabs
} elseif ("Tabs" == _get_field('mtm_select_component')) {
    mtm_get_template_part('mtm-component', 'tabs');
    // CTA
} elseif ("Call To Action" == _get_field('mtm_select_component')) {
    mtm_get_template_part('mtm-component', 'call-to-action');
    // Extra Content
} elseif ("Extra Content" == _get_field('mtm_select_component')) {
    mtm_get_template_part('mtm-component', 'extra-content');
    // Standard Content or None Selected
} else {
    mtm_get_template_part('mtm-component', 'standard');
}
<?php

$headline = get_the_title();
if ("Custom Headline" == get_sub_field('mtm_hero_select_title')) {
    $headline = get_sub_field('mtm_hero_headline');
}
?>

<section class="mtm-module--hero mtm-hero-image" style="background-image:url('<?php 
echo esc_url(mtm_acf_sub_image_property('mtm_hero_image', 'url'));
?>
')">
	<div class="mtm-module--hero-content mtm-hero-image-content">
		<h2 class="mtm-module--hero-title mtm-hero-image-title mtm-module-title"><?php 
esc_attr_e($headline);
?>
</h2>
		<div class="mtm-module--hero-subtitle mtm-hero-image-subtitle"><?php 
the_sub_field('mtm_hero_subheading');
?>
</div>
		
		<?php 
mtm_get_template_part('mtm-content', 'home-buttons');
?>

	</div>
</section>
        $post = $org_post;
        // reset to original query
    }
    ?>

	</div>

<?php 
} else {
    // Manual Source (repeater)
    if (have_rows('mtm_add_list_item')) {
        // Repeater
        ?>

		<div class="mtm-module--list">

			<?php 
        while (have_rows('mtm_add_list_item')) {
            the_row();
            // Loop through each itemm
            mtm_get_template_part('mtm-content', 'list-module');
        }
        ?>

		</div>
	 
	 <?php 
    }
    // End List
}
// End Pick from Source
<?php

// Extra Content
?>

<h2 class="h1"><?php 
the_title();
edit_post_link('(Edit)', ' • ');
?>
</h2>
<div <?php 
post_class('mtm-component--main');
?>
>
	<?php 
mtm_get_template_part('mtm-content', 'component-page');
?>
</div>
	
<?php 
mtm_get_template_part('mtm-content', 'extra-content');
					<div class="mtm-home-topic--single <?php 
            echo $mtm_news_feature_count;
            ?>
">
						<div class="mtm-home-topic--single-content">
					
						<?php 
            while ($topic_tax_query->have_posts()) {
                // Each Topic
                $topic_tax_query->the_post();
                if (1 == $i++) {
                    // First story will load the header, image, and title
                    mtm_get_template_part('mtm-content', 'home-topic-block');
                } else {
                    // All other stories just load title
                    mtm_get_template_part('mtm-content', 'home-topic-small');
                }
                ?>

						<?php 
            }
            // End Topic
            ?>

						</div>
					</div>

				<?php 
        }
        ?>
					<?php 
            mtm_get_template_part('mtm-module', 'list');
            ?>

				</div>

			<?php 
            // Grid Posts
        } elseif ("mtm_module_gridlist_posts" == get_row_layout()) {
            ?>
				
				<div class="<?php 
            echo get_row_layout();
            ?>
">

					<?php 
            mtm_get_template_part('mtm-module', 'grid');
            ?>

				</div>

			<?php 
        }
        ?>

		</section>

	<?php 
    }
}
        $post = $org_post;
        // reset to original query
    }
    ?>

	</div>

<?php 
} else {
    // Manual Source (repeater)
    if (have_rows('mtm_add_list_item')) {
        // Repeater
        ?>

		<div class="mtm-module--grid">

			<?php 
        while (have_rows('mtm_add_list_item')) {
            the_row();
            // Loop through each itemm
            mtm_get_template_part('mtm-content', 'grid-module');
        }
        ?>

		</div>	
	
	<?php 
    }
    // End Rows
}
// End Pick from Source
<?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 
}
<?php

// Home Feature (ACF Repeater Field)
global $mtm_home_feature_count;
$mtm_home_feature_count = count(get_sub_field('mtm_home_featured_content_boxes'));
if (get_sub_field('mtm_text_area_title')) {
    ?>

	<h2 class="mtm-module--content-heading mtm-module-title"><?php 
    the_sub_field('mtm_text_area_title');
    ?>
</h2>

<?php 
}
if (have_rows('mtm_home_featured_content_boxes')) {
    mtm_get_template_part('mtm-logic', 'featured-content');
    ?>

<?php 
}
// End ACF Repeater Field
			<?php 
if (has_post_thumbnail()) {
    ?>

		            <figure class="post--thumbnail"><?php 
    the_post_thumbnail('full');
    ?>
</figure>

		    <?php 
}
?>

		    <?php 
if (is_active_sidebar('news-page-sidebar')) {
    dynamic_sidebar('news-page-sidebar');
}
?>

		</div>

	</section>

</section>

<?php 
// Topics
if (_get_field('mtm_home_topic_sections')) {
    mtm_get_template_part('mtm-logic', 'topic-sections');
}
<?php

/*
Template Name: Home Page Builder
*/
mtm_load_wrap_header();
// Standard Homepage
mtm_get_template_part('mtm-layout', 'home-standard');
// Single Scroll
if (_get_field('mtm_enable_single_scroll_page')) {
    mtm_get_template_part('mtm-logic', 'single-scroll');
}
mtm_load_wrap_footer();
?>
</h1>
		<?php 
// the_content();
// Something is filtering the_content, figure out what that is so I can change this
$home_post = get_post(get_the_ID());
echo apply_filters('the_content', $home_post->post_content);
// Buttons
if (_get_field('mtm_home_button_repeater')) {
    mtm_get_template_part('mtm-content', 'home-buttons');
}
// Featured Image
if (has_post_thumbnail()) {
    ?>
	            <figure class="post--thumbnail"><?php 
    the_post_thumbnail('full');
    ?>
</figure>
	    <?php 
}
?>

	</section>

</section>

<?php 
// Featured Content
if (_get_field('mtm_enable_featured_content')) {
    mtm_get_template_part('mtm-home', 'featured-content');
}
<?php

// Hero Video/Media
// Video
if ("Video" == get_sub_field('mtm_hero_select_media')) {
    ?>
	
	<?php 
    mtm_get_template_part('mtm-content', 'hero-video');
    ?>

<?php 
    // Other
} elseif ("Other Media" == get_sub_field('mtm_hero_select_media')) {
    ?>
	
	<?php 
    mtm_get_template_part('mtm-content', 'hero-video');
    ?>

<?php 
}
<?php

// Tab Component
?>

<h2 class="h1"><?php 
the_title();
edit_post_link('(Edit)', ' • ');
?>
</h2>
<div <?php 
post_class('mtm-component--main');
?>
>
	<?php 
mtm_get_template_part('mtm-content', 'component-page');
?>
</div>

<?php 
mtm_get_template_part('mtm-content', 'tabs');
?>
	<?php 
if (_get_field('mtm_show_taxonomy_links')) {
    mtm_terms_from_taxonomy_links($taxonomy);
    // output taxonomy
}
?>
</div>

<?php 
if ($grid_query->have_posts()) {
    ?>

	<div class="mtm-component--content mtm-grid--wrapper">
		<div class="gallery-dynamic-row" >

			<?php 
    while ($grid_query->have_posts()) {
        $grid_query->the_post();
        mtm_get_template_part('mtm-content', 'grid-view');
    }
    wp_reset_postdata();
    ?>

		</div>
		<div class="expanded-gallery-single"></div>
	</div>

<?php 
}
// end grid_query
<?php

/*
Template Name: Modular Content Page
*/
mtm_load_wrap_header();
?>

<section class="content--page">

	<?php 
mtm_get_template_part('mtm-logic', 'modules');
?>

</section>

<?php 
mtm_load_wrap_footer();
        ?>

		<section id="<?php 
        echo $post->post_name;
        ?>
" class= "mtm-component mtm-section-<?php 
        echo $j++;
        ?>
">

			<section class="content--<?php 
        echo $post->post_name;
        ?>
">

				<div class="content--page">

					<?php 
        mtm_get_template_part('mtm-logic', 'components');
        ?>

				</div>

			</section>

		</section>

	<?php 
    }
    wp_reset_postdata();
}
示例#22
0
function mtm_ajax_filter_get_posts($taxonomy)
{
    // Verify nonce
    if (!isset($_GET['mtm_nonce']) || !wp_verify_nonce($_GET['mtm_nonce'], 'mtm_nonce')) {
        die('Nonce is not verified');
    }
    // get taxonomy and term data from term id
    $taxonomy = $_GET['taxonomy'];
    $term_obj = get_term($taxonomy);
    $term_slug = $term_obj->slug;
    $term_tax = $term_obj->taxonomy;
    // run query from function
    $ajax_query = mtm_page_component_taxonomy_query($term_tax, $term_slug, 12, 'menu_order');
    if ($ajax_query->have_posts()) {
        while ($ajax_query->have_posts()) {
            $ajax_query->the_post();
            // template part
            mtm_get_template_part('mtm-content', 'grid-view');
        }
        wp_reset_postdata();
    }
    die;
}