Category Custom Fields
Fixed and confirmed with WP 3.1.2 (2 posts)

  1. rallisf1
    Posted 3 years ago #

    Hi guys i am just reposting a fix so you can all enjoy this awesome plugin along with a tip on how to use it.

    First of all in order to save custom field data you have to edit categoryCustomFieldsAdminHandle.php on line 28 and change the whole line to:
    if( !(($f->field_type =='image' || $f->field_type =='file') && strlen($value)<=0))
    After this trick the plug-in should now work like a charm. Now lets say you want to use a custom category page depending on a single custom field value. First create a text custom category field through the Category Settings in your admin panel. Then add a field value to a category. For example i'll use field name "type" and field value "tournament". Open up your theme's archive.php and add this code

    <?php $array = categoryCustomFields_GetCategoriesByCustomField(type,tournament);
      foreach($array as $tournament) { if ($tournament->term_id == $cat) $tour = TRUE; } ?>

    Then you can use if ($tour == TRUE) ... and customize however you like.
    I am making a kids' football page and i want to customize the category pages which refer to tournaments and as new tournaments would be added every once in a while having static theme pages (like category-5.php) wasn't efficient enough. Hope this helps.



  2. radiofranky
    Posted 3 years ago #

    I have tried several methods retrieving category custom fields, however, with no success so far.

    this is what I have but it prints out "array"

    <?php $result = categoryCustomFields_GetCategoryCustomField($category->cat_ID,'Synopsis_info');
    echo $category->cat_ID;


    thanks for the help

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Category Custom Fields
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic