$key ) ) { return $json->$key; } return $value; } /** * Function to refresh customize preview when changing sections order */ public function refresh_positions() { $section_order = get_theme_mod( 'bloglo_sections_order' ); $section_order_decoded = json_decode( $section_order, true ); if ( ! empty( $section_order_decoded ) ) { remove_all_actions( 'bloglo_sections' ); foreach ( $section_order_decoded as $k => $priority ) { $this->hook_section_by_slug( $k, $priority ); } } } /** * Hook section by slug. * * @param string $slug section slug. * @param integer $priority section priority. */ private function hook_section_by_slug( $slug, $priority ) { if ( empty( $slug ) ) { return; } add_action( 'bloglo_sections', $slug, absint( $priority ) ); } } function bloglo_section_reordering() { return Bloglo_Section_Ordering::instance(); } bloglo_section_reordering();