Custom Fields
Support MB Relationships Color field in repeater.

  • Creator
  • #31662
    Wojtek Piskorz

    I'm using oxygen and metabox. I have 2 CPT. Product and Categories. Categories has some custom fields where one of it is "color picker".

    I need to create a repeater for this color picker. and codeblock with code:

        $catColor = rwmb_meta('cat_color');
        echo $catColor; 

    but I need to somehow dynamically adjust it for class because if I use:

        $catColor = rwmb_meta('cat_color');
        echo $catColor; 
    .cat__bg-color {
    background-color: <?php echo $catColor ?>;

    its populates all with the first color it'll find on a page. Is there a workaround for that?

    (echo works - it is showing different #hex for each repeater element)

Viewing 1 replies (of 1 total)
  • Author
  • #31670
    Long Nguyen


    You can pass the third parameter to the helper function rwmb_meta() to get the color of a specific post

    $catColor = rwmb_meta('cat_color', '', 12345);

    Refer to this documentation

    If you want to get the post ID dynamically, please contact Oxygen support to ask for getting the post ID in the repeater module.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.