WordPress.org

Ready to get started?Download WordPress

Forums

Category Custom Fields
quick function i wrote (1 post)

  1. alexeightsix
    Member
    Posted 2 years ago #

    I wrote two very basic functions to make it easier to retrieve data, thought i would share it if anyone wanted it. Might be duplicating the wheel here, not sure if the pre-made functions do this already. Only feature request I ask of the author is to be able to pre-define select menus with data, and use the wordpress image uploader api for image fields.

    function get_cat_meta($id, $field_name) {
    global $wpdb;
    $query = "SELECT field_value FROM wp_ccf_Value WHERE term_id = '" . $id . "' AND field_name = '" . $field_name . "' ";
    $result = $wpdb->get_row($query);
    return $result->field_value;
    }

    function get_all_meta($id) {
    global $wpdb;
    $query = "SELECT DISTINCT field_name FROM wp_ccf_Value";
    $result = $wpdb->get_results($query);
    foreach ($result as $value) {
    $slide[$value->field_name] = get_cat_meta($id, $value->field_name);
    }
    return $slide;

    }

    http://wordpress.org/extend/plugins/categorycustomfields/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

  • RSS feed for this topic
  • Started 2 years ago by alexeightsix
  • This topic is not a support question
  • WordPress version: 3.3.1