Custom Fields
Support General Help with Background Field

  • Creator
  • #10914
    Resolved tsquez

    Hi there,

    I need some help understanding how the background field works.

    I have it implemented, and it shows up the way it's supposed to and holds all the values it's supposed to....great!

    However I am having a hard time outputting the information from the background field. I have read the documentation here: but I just can't seem to wrap my head around it.

    Could you possibly provide an example of what to do, maybe just a small tutorial on how to use the background field and apply the information from the field to a simple div?

    I think this would be a great addition to the tutorial section.

    Any help is greatly appreciated. Thanks in advance.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Author
  • #10917
    Anh Tran

    Hi Thomas,

    The background field saves details into an array. If you use the helper function rwmb_meta() to get its value - you'll get an array.

    To get the generated CSS for the background, please use the function rwmb_the_value().

    This is the sample code:

    $bg = rwmb_meta( 'field_id' );
    echo $bg['color']; // Output a single background attribute
    // Get CSS for background
    $css = rwmb_the_value( 'field_id', '', '', false );
    echo $css;

    Hi Anh,

    Wow, I thought you would try and explain a little bit more than repeating what is already in the docs located here

    I'm sorry I forgot to mention that I did try both of those methods.

    So again I ask, maybe you can do a little tutorial and show me and others how to add a background image to a container. Nothing fancy, something super duper easy.

    Trust me, it's very confusing.

    Yes No?


    Or maybe this: A tutorial on how to actually use rwmb_meta() and rwmb_the_value().

    Like how would I actually use:

    $css = rwmb_the_value( $field_id, '', '', false );
    echo '';

    (taken from the background field documentation...doesn't seem to work properly though) and use it to show a background image for div.

    I tried using the code I pasted from the background field docs and it doesn't even work. In the example given the css is supposedly wrapped in a div but it doesn't work.

    Anh Tran

    Hi Thomas,

    I'll create a tutorial and video to demonstrate how those helper functions work and what is the difference between them. Please wait a little.



    Oh yeah most def. Sorry if I seem overly excited but I have reached a certain point in this project and I'd like to get it done and move on to the next part...again sorry.

    I think you should do this for all the fields: Make a tutorial or a video or both. I know this would make your site even more AWESOME.

    Thanks again for the help. I appreciate it.

    Anh Tran

    Hi Thomas, here is the video tutorial:

    Please pay attention to the text I wrote in the video :).

    Hope you like it.

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