Statbar customizations

Hello!

I realize upfront that this is outside the scope of the support you provide, but I’m hoping you can at least point me in the right direction.

I’m using the Pro theme, and I have a page with 4 Statbar elements. I would like to write an interface to allow a very non-technical user to be able to update the label and percentage settings for these statbars.

I found the _cornerstone_data and _cs_generated_styles columns in the wp_postmeta table where it appears this data is stored. If you could just give me a brief clue about the best way to parse these fields and access/update these two parameters I would be very appreciative.

Thanks in advance for anything you can do to help!

Hi Christine,

Thanks for writing in.

The code responsible for parsing that data is this,

function cs_get_serialized_post_meta( $post_id, $key = '', $single = false, $filter = '' ) {
  $meta_value = get_post_meta( $post_id, $key, $single );
  if ( $filter ) {
    $meta_value = apply_filters( $filter, $meta_value );
  }
  return cs_maybe_json_decode( $meta_value );
}

Then you should able to retrieve it like shi

$data = get_post_meta( 343, '_cornerstone_data', true );

$style = get_post_meta( 343, '_cs_generated_styles', true );

And you may also check this documentation https://developer.wordpress.org/reference/functions/get_post_meta/. The return value should be an array for the data.

Thanks!

1 Like

Thank you - that helped enormously! I am very grateful for the help I have received on this forum, both by searching for previous questions and asking a couple of my own. :grinning:

You’re welcome!
We’re glad @Rad were able to help you out.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.