Results 1 to 1 of 1

Thread: Classipress ad meta fields by category

  1. #1
    Thread Starter
    refinfo's Avatar
    Join Date
    Mar 2013
    Thanked 0 Times in 0 Posts

    Classipress ad meta fields by category


    I'm developing a website for my client and I have accustomed myself to the general meta field architecture of the ads (ad_listing) post type in Classipress. I understand that when installing classipress, a custom table is made "wp_cp_ad_fields" where the meta fields are stored. I also found the install.php where meta fields are inserted into the table on the first run of Wordpress and as such I am aware how to insert more meta fields to the Ads.

    My problem:

    My client has a few different types of ad categories (real estate, cars, services, etc...) and I would like to implement different meta fields for different ad categories. Ala. real estate ads will have meta fields like m2, number of rooms and cars will have meta fields like kw, body type, etc. Is this in any way doable in the standard classipress solution or do I need to develop some sort of extra system for it?

    The code I'd use to insert meta fields is as follows

    PHP Code:
    $field_sql "SELECT field_id FROM wp_cp_ad_fields WHERE field_name = %s LIMIT 1";
    //VD Test field
    $wpdb->get_results$wpdb->prepare($field_sql'vd_cp_test_2') );
    if ( 
    $wpdb->num_rows == ) {
    $wpdb->insert'wp_cp_ad_fields', array(
    'field_name' => 'vd_cp_test_2',
    'field_label' => 'test2',
    'field_desc' => 'This is the TEST of the ad and is mandatory on all forms. It is a core ClassiPress field and cannot be deleted.',
    'field_type' => 'text box',
    'field_values' => '',
    'field_search' => '0',
    'field_perm' => '1',
    'field_core' => '1',
    'field_req' => '1',
    'field_owner' => 'ClassiPress',
    'field_created' => current_time('mysql'),
    'field_modified' => current_time('mysql'),
    'field_min_length' => '0'
    ) );

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How can I associate Meta Data Filter Plugin to classipress custom fields
    By gizempiskin in forum Help Using ClassiPress
    Replies: 2
    Last Post: April 19th, 2015, 04:09 PM
  2. Replies: 5
    Last Post: October 30th, 2012, 03:44 PM
  3. Meta Fields Not Working
    By mintiesme in forum Report ClassiPress Bugs
    Replies: 3
    Last Post: October 26th, 2012, 08:03 AM
  4. [SOLVED] Custom fields & meta ....PLS help!
    By billis in forum Report ClassiPress Bugs
    Replies: 2
    Last Post: September 2nd, 2011, 03:09 PM