WordPress.org

Support

Support » Plugins and Hacks » Custom Content Type Manager » [Plugin: Custom Content Type Manager] Correlate custom field

[Plugin: Custom Content Type Manager] Correlate custom field

  • Goodmorning,
    is it possibile to correlate with custom-content-type-manager two custom field such as Text fields con Output Filter settled on “array”?

    For example:

    The first field is an array named “price”, with value: “price 1”, “price 2”, “price 3”.

    The second field is an array named “price note” with value: “price note 1”, “price note 2”, “price note 3”

    I would like to correlate these results between them:
    – “Price 1” associated with “known to the price of 1”
    – “Price 2” associated with “known to the price of 2”
    – “Price 2” associated with “known to the price of 2”

    tanks

    http://wordpress.org/extend/plugins/custom-content-type-manager/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor fireproofsocks

    @fireproofsocks

    There are probably a lot of ways to do that: it’s all a matter of how you structure your data. In this situation I’d probably just add the “associated” data into an array in my template file, e.g.:

    <?php
    $associated_data = array(
       'price_1' => 'Something related to price_1',
       'price_2' => 'Something related to price_2',
    );
    // And then look up the price:
    $price = get_custom_field('price');
    
    // Then lookup the associated data:
    if (isset($associated_data[$price])) {
       print $associated_data[$price];
    }
    else {
       print 'No associated price data';
    }
    ?>

    See how that works? We use the $price to look up a key in the $associated_data hash.

    That’s probably the easiest option. Alternatively, you could set up a dedicated post-type for the associated data and use a relation field to select the price you want.

    tankyou for your reply,
    now study this and post the result.

    Plugin Contributor fireproofsocks

    @fireproofsocks

    Let me know how it goes.

    Maybe you can check the box on your dropdown definition to use separate values/labels…

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Custom Content Type Manager] Correlate custom field’ is closed to new replies.
Skip to toolbar