How to get this value inside RETURN

This is more of a PHP question then a WordPress one but the answer is simple, just use PHP’s output buffer by wrapping the first code snippet eg: //create a function for the filters function get_filters(){ $terms = get_terms(‘YOUR-TAXONOMY’); if ( $terms ) { ob_start(); ?> <ul id=”portfolioFilter”> <li class=”filter” data-filter=”all”>All</li> <?php foreach ( $terms … Read more

Custom Taxonomy Not Saving in Front End Post

I figured this out after much trial and error. Made some slight changes to the $new_post array. else if( !$error_msg && ‘POST’ == $_SERVER[‘REQUEST_METHOD’] && !empty( $_POST[‘action’] ) && $_POST[‘action’] == “new_post”){ $new_post = array( ‘post_title’ => $title, ‘post_content’ => $description, ‘post_category’ => array($_POST[‘cat’]), // Usable for custom taxonomies too ‘tags_input’ => array($tags), ‘tax_input’ => … Read more

Wp_query…a type of term a different div

The easiest way is to just create conditional statements checking for the term and wrapping it in a div of your choice. After you loop starts you could do something like: while ($list_query->have_posts()) : $list_query->the_post(); if( has_term( ‘casegoods’, ‘tag-series’ ) ) { echo ‘<div class=”left-side”>’; the_content(); echo ‘</div>’; } elseif ( has_term( ‘casegoods’, ‘rugs’ ) … Read more

Add custom taxonomy as a css class

Your code shows how it fetches posts, but not, how it fetches the $term. On a proper development environment (WP_DEBUG is set to TRUE) this code should trigger a notice, that $term is unknown at this point. However, I suggest to use the template function post_class() to display relevant information of the post as HTML … Read more