Making WordPress.org


Ignore:
Timestamp:
02/24/2016 10:22:00 PM (10 years ago)
Author:
iandunn
Message:

WordCamp Post Types: Add a Add New Invoice button to Sponsor posts.

Sponsors are created/edited on one screen, and invoices for those sponsors are created on a separate screen, so having links between the screens helps users understand where they need to go.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wc-post-types/wc-post-types.php

    r2503 r2598  
    13111311        add_meta_box( 'session-info',   __( 'Session Info',   'wordcamporg'  ), array( $this, 'metabox_session_info'   ), 'wcb_session',   'normal' );
    13121312        add_meta_box( 'sponsor-info',   __( 'Sponsor Info',   'wordcamporg'  ), array( $this, 'metabox_sponsor_info'   ), 'wcb_sponsor',   'normal' );
     1313        add_meta_box( 'invoice-sponsor', __( 'Invoice Sponsor', 'wordcamporg' ), array( $this, 'metabox_invoice_sponsor' ), 'wcb_sponsor', 'side'   );
    13131314    }
    13141315
     
    15291530
    15301531    /**
     1532     * Render the Invoice Sponsor metabox view
     1533     *
     1534     * @param WP_Post $sponsor
     1535     */
     1536    function metabox_invoice_sponsor( $sponsor ) {
     1537        $current_screen = get_current_screen();
     1538
     1539        $existing_invoices = get_posts( array(
     1540            'post_type'      => \WordCamp\Budgets\Sponsor_Invoices\POST_TYPE,
     1541            'post_status'    => 'any',
     1542            'posts_per_page' => - 1,
     1543
     1544            'meta_query' => array(
     1545                array(
     1546                    'key'   => '_wcbsi_sponsor_id',
     1547                    'value' => $sponsor->ID,
     1548                ),
     1549            ),
     1550        ) );
     1551
     1552        $new_invoice_url = add_query_arg(
     1553            array(
     1554                'post_type'  => 'wcb_sponsor_invoice',
     1555                'sponsor_id' => $sponsor->ID,
     1556            ),
     1557            admin_url( 'post-new.php' )
     1558        );
     1559
     1560        require_once( __DIR__ . '/views/sponsors/metabox-invoice-sponsor.php' );
     1561    }
     1562
     1563    /**
    15311564     * Fired when a post is saved, makes sure additional metadata is also updated.
    15321565     */
Note: See TracChangeset for help on using the changeset viewer.