Skip to content

Instantly share code, notes, and snippets.

@sarfarazansari
Last active February 14, 2022 04:25
Show Gist options
  • Save sarfarazansari/2b0f16bb80b827a91aeb8f955d957b53 to your computer and use it in GitHub Desktop.
Save sarfarazansari/2b0f16bb80b827a91aeb8f955d957b53 to your computer and use it in GitHub Desktop.

Revisions

  1. sarfarazansari revised this gist Feb 14, 2022. 1 changed file with 28 additions and 0 deletions.
    28 changes: 28 additions & 0 deletions function.php
    Original file line number Diff line number Diff line change
    @@ -13,4 +13,32 @@ function set_custom_edit_rezept_columns($columns) {
    ));

    return $columns;
    }

    // Add the data to the custom columns for the book post type:
    add_action( 'manage_rezept_posts_custom_column' , 'custom_rezept_column', 10, 2 );
    function custom_rezept_column( $column, $post_id ) {
    switch ( $column ) {

    case 'recipe_status' :
    echo get_post_meta( $post_id, 'recipe_status', true);
    break;

    case 'name':
    echo get_post_meta( $post_id, 'name', true);
    break;

    case 'email':
    echo get_post_meta( $post_id, 'email', true);
    break;

    case 'group_of_people':
    echo get_post_meta( $post_id, 'group_of_people', true);
    break;

    case 'activation_date':
    echo get_the_modified_date('l jS \of F Y h:i:s A', $post_id);
    break;

    }
    }
  2. sarfarazansari created this gist Feb 14, 2022.
    16 changes: 16 additions & 0 deletions function.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@

    // Add the custom columns to the rezept post type:
    add_filter( 'manage_rezept_posts_columns', 'set_custom_edit_rezept_columns' );
    function set_custom_edit_rezept_columns($columns) {
    unset($columns['date']);
    return array_merge ( $columns, array (
    'name' => __('Vor- & Nachname'),
    'email' => __('E-mail Adresse'),
    'group_of_people' => __('Personengruppe'),
    'activation_date' => __('Erstellungsdatum'),
    'recipe_status' => __('Status'),
    'date' => __('Veröffentlicht')
    ));

    return $columns;
    }