0

How can I exclude items from appearing in a K2 mod_k2_content module when a extra field is a certain value?

Eg I am showing all properties at the moment. There is an extra field called Sold? which is a boolean. If true, I do not want it appearing in the listing.

ktharsis
  • 3,160
  • 1
  • 19
  • 30
robzolkos
  • 2,196
  • 3
  • 30
  • 47

1 Answers1

1

here is a sample just to give you an idea, hope it helps

<?php 
  foreach ($item->extra_fields as $extraField):
      if($extraField->sold != true){
           echo $item->title . '<br />'; 
           echo $item->introtext;
      } 
  endforeach; 
?>
Lodder
  • 19,758
  • 10
  • 59
  • 100
Iamowrange
  • 326
  • 1
  • 5
  • which file do I edit for this? Currently the modules in question are shown on the home page. – robzolkos Nov 26 '12 at 03:49
  • you put this on the default.php mod_k2_content/tmpl of the assigned module in your homepage, you must know the position of the module you are trying to edit, and ovverride its template. its hard to explain without visuals, read template override first – Iamowrange Nov 26 '12 at 04:06
  • If this works for you, I would recommend making a template override for the module rather than editing the core of it. It will prevent the file from getting overwritten if you ever install an update. For more information on this, see this: http://docs.joomla.org/How_to_override_the_output_from_the_Joomla!_core – Lodder Nov 26 '12 at 04:09