Skip Navigation

[Resolved] Manage with types not working as expected

This thread is resolved. Here is a description of the problem and solution.

Problem:
The customer's theme has a custom field for Taglines, he went to Post Field Control and set it to "manage with types" but the content will not appear on the front-end:
Solution:
The option Manage with types will allow you to use that custom field inside a Toolset custom field group, but it won't automatically link it to the custom field available inside the custom theme or plugin.

Upon further review, that fields was serialized by the theme and placed inside a 'lp_listingpro_options' option. I had to use custom code to retrieve this field. I added it to a shortcode and registered the shortcode within Toolset settings, then the field managed by the theme became available to be used in the front end as well. The shortcode was this:

function my_shortcode_callback( $atts ){    
    // Get the tagline from post_meta
    $myvals = maybe_unserialize(get_post_meta($atts['post_id'], 'lp_listingpro_options'));
    return $myvals[0]["tagline_text"];  
}
add_shortcode( 'tagline_text', 'my_shortcode_callback' );

Relevant Documentation:
https://developer.wordpress.org/reference/functions/get_post_meta/
https://wp-staging.com/serialized-data-wordpress-important/
https://wpengine.com/support/wordpress-serialized-data/
https://deliciousbrains.com/wp-migrate-db-pro/doc/serialized-data/
https://developer.wordpress.org/reference/functions/maybe_serialize/
https://developer.wordpress.org/reference/functions/maybe_unserialize/

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Sao_Paulo (GMT-03:00)

This topic contains 14 replies, has 2 voices.

Last updated by Timothy 8 months, 2 weeks ago.

Assisted by: Mateus Getulio.

Author
Posts
#2692466

Thanks, I'm all set now.