I have a layout for a CPT that uses {{dc:post:meta key="_sfwd-courses"}}
This meta is stored in the database as a serialized array. I need to get the value for the key sfwd-courses_course_price
, which in my case is 12.99
, out of this serialized array.
What is the best way to go about doing this?
Example of serialized array:
a:32:{i:0;s:0:"";s:30:"sfwd-courses_course_price_type";s:6:"paynow";s:40:"sfwd-courses_course_prerequisite_enabled";s:0:"";s:32:"sfwd-courses_course_prerequisite";s:0:"";s:40:"sfwd-courses_course_prerequisite_compare";s:3:"ANY";s:34:"sfwd-courses_course_points_enabled";s:0:"";s:26:"sfwd-courses_course_points";s:0:"";s:33:"sfwd-courses_course_points_access";s:0:"";s:26:"sfwd-courses_expire_access";s:0:"";s:31:"sfwd-courses_expire_access_days";i:0;s:42:"sfwd-courses_expire_access_delete_progress";s:0:"";s:36:"sfwd-courses_course_price_billing_p3";s:0:"";s:31:"sfwd-courses_course_trial_price";s:0:"";s:37:"sfwd-courses_course_trial_duration_t1";s:0:"";s:37:"sfwd-courses_course_trial_duration_p1";s:0:"";s:36:"sfwd-courses_course_price_billing_t3";s:0:"";s:25:"sfwd-courses_course_price";s:5:"12.99";s:30:"sfwd-courses_custom_button_url";s:0:"";s:37:"sfwd-courses_course_materials_enabled";s:0:"";s:29:"sfwd-courses_course_materials";s:0:"";s:24:"sfwd-courses_certificate";s:0:"";s:27:"sfwd-courses_exam_challenge";i:0;s:41:"sfwd-courses_course_disable_content_table";s:0:"";s:35:"sfwd-courses_course_lesson_per_page";s:0:"";s:42:"sfwd-courses_course_lesson_per_page_custom";s:0:"";s:41:"sfwd-courses_course_topic_per_page_custom";s:0:"";s:40:"sfwd-courses_course_lesson_order_enabled";s:0:"";s:34:"sfwd-courses_course_lesson_orderby";s:10:"menu_order";s:32:"sfwd-courses_course_lesson_order";s:3:"ASC";s:46:"sfwd-courses_course_disable_lesson_progression";s:0:"";s:37:"sfwd-courses_course_short_description";s:549:"In this study, we explore Psalm 119 and discover what it really means to “love” God’s instruction—even in the midst of the most difficult circumstances. ";s:52:"sfwd-courses_course_price_type_paynow_enrollment_url";s:0:"";}