Reply To: Category Name Filter Not Working

#6909

Ernest Marcinko
Keymaster

Oh I see the problem now 🙂

Your solution was actually almost correct. The problem was that the custom field “design” returned the term ID not the term name. Instead of that solution I've changed the custom code to this:

add_filter( 'asp_pagepost_results', 'asp_add_term_titles', 1, 1 );
 
function asp_add_term_titles( $pageposts ) {
  foreach ($pageposts as $k=>$v) {
    
    $colorway = "<span class=colorway>" . get_post_meta($v->id, "colorway", true) . "</span>";
    $design = get_post_meta($v->id, "design", true);
    
    if ( $design !== false ) {
      $d_term = get_term($design, "designs");

      if ( isset($d_term->name) )
        $pageposts[$k]->title = $d_term->name . " " . $colorway;
      
    }
  }
 
  return $pageposts;
}

this one additionally parses the design custom field, then gets the term from that field accordingly.

As for the margin, I've forgotten to implement that option in the current version, I noticed too late 🙂 It's a parameter of the isotope calculation script, so it's hard coded right now.
However there is a workaround with CSS, but it's not nearly as good as changing the isotope parameter. Basically adding transparent left, right border to the items appears as space, like so:

.isotopic .results .item {
    border-right: 5px solid transparent !important;
    border-left: 5px solid transparent !important;
}

this basically adds 10 pixels inbetween, but 5 pixels on each side as well, so it's not near perfect.

Best,
Ernest Marcinko

If you like my products, don't forget to rate them on codecanyon :)