Registerkarte verwenden "Meta"im Popup-Fenster" Tabellen-Tools ".
Sie können es auch per Code hinzufügen. Verwenden Sie den nächsten Code in der Datei functions.php:
1 2 3 4 5 6 7 8 9 10 11 12 13 | add_action('woot_profile_extend', function($profile, $action_name) { $profile['hmeta_1'] = [ 'title' => WOOT_Vocabulary::get('Meta 1'), 'order' => 'asc', 'display' => false, //display in fields list in the settings 'action' => function($post_id) { return get_post_meta($post_id, 'meta_1', true); } ]; return $profile; }, 10, 2); |
Trough code you can use custom columns in such shortcodes as [woot_upsells]: [woot_upsells id=49 columns='id,title,price,hmeta_1,cart']
Auch für einige Tabellen ist es möglich, Ergebnisse in der Tabellenzelle zu ändern:
1 2 3 4 5 6 7 8 | add_action('woot_meta_data_cell', function($value, $meta_data, $post_id, $table_id) { if ($meta_data['meta_key'] === 'meta_1' AND $table_id === 21) { $value = floatval($value) * floatval(get_post_meta($post_id, 'meta_2', true)); } return $value; }, 10, 4); |
Dieser Code für Tabelle 21 in der Metazelle meta_1 zeigt die Ergebnisse einer mathematischen Operation an.
