i’m new to cmb2 and i hope you can help me.
I want to echo my posts but only when i triggered a checkbox in backend.
this is my current code im a little bit lost.
<?php get_header(); ?>
$taxonomies = get_object_taxonomies( array( 'post_type' => 'faq',) );
foreach( $taxonomies as $taxonomy ) :
// Gets every "category" (term) in this taxonomy to get the respective posts $terms = get_terms( array( 'taxonomy' => 'faqt', 'parent' => 0, 'hide_empty' => 0, ) ); foreach( $terms as $term ) : ?>
<h3><a href='faqt/<? echo $term->slug; ?>'><? echo $term->name; ?></a></h3>
<?php $args = array( 'post_type' => 'faq', 'posts_per_page' => -1, 'tax_query' => array( array( 'taxonomy' => $taxonomy, 'field' => 'slug', 'terms' => $term->slug, ) ) ); $posts = new WP_Query($args); if( $posts->have_posts() ): while( $posts->have_posts() ) : $posts->the_post(); ?> <ul> <li><a href="<?php echo get_permalink(); ?>"><?php echo get_the_title(); ?></a></li>
<?php the_excerpt(); ?> <?php endwhile; endif; ?> <a href='faqt/<? echo $term->slug; ?>' class=“btn btn-secondary”>Alle Fragen</a>
<?php get_footer(); ?>
I hope you guys can help me
thx ! 🙂
Hello CMB2 gang.
It's been a while since I've included CMB2 on a project and, as I'm getting a new theme (not for distribution) set up, I'm wondering what the current best practice is?
I'm thinking it's one of the following:
I'm also curious if the best method is different depending on my purpose. Say, if I were building a plugin for redistribution, would I include CMB2 as a dependency in the project or just note that users need to install the official CMB2 plugin and leave it out?