Inventory_Presser_Classic_Editor::meta_box_html_prices( WP_Post $post, mixed $meta_box )

Creates a meta box to help users manage a vehicles prices in the editor.


Parameters Parameters

$post

(WP_Post) (Required)

$meta_box

(mixed) (Required)


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/integrations/class-classic-editor.php

	public function meta_box_html_prices( $post, $meta_box ) {
		$prices = array(
			'price'        => __( 'Price', 'inventory-presser' ),
			'msrp'         => __( 'MSRP', 'inventory-presser' ),
			'down_payment' => __( 'Down payment', 'inventory-presser' ),
			'payment'      => __( 'Payment', 'inventory-presser' ),
		);

		echo '<table class="form-table"><tbody>';
		foreach ( $prices as $key => $label ) {
			$meta_key = apply_filters( 'invp_prefix_meta_key', $key );

			printf(
				'<tr><th scope="row"><label for="%1$s">%2$s</label></th>'
				. '<td><input type="text" name="%1$s" value="%3$s" onkeypress="return is_number(event)"></td></tr>',
				esc_attr( $meta_key ),
				esc_html( $label ),
				esc_attr( INVP::get_meta( $key, $post->ID ) )
			);
		}

		// Payment frequency is a drop-down.
		printf(
			'<tr><th scope="row"><label for="%1$s">Payment frequency</label></th>'
			. '<td><select name="%1$s"><option></option>',
			esc_attr( $meta_key )
		);

		$frequencies = apply_filters(
			'invp_default_payment_frequencies',
			array(
				'Monthly'      => 'monthly',
				'Weekly'       => 'weekly',
				'Bi-weekly'    => 'biweekly',
				'Semi-monthly' => 'semimonthly',
			)
		);
		foreach ( $frequencies as $key => $value ) {
			printf(
				'<option value="%s"%s>%s</option>',
				$value,
				selected( invp_get_the_payment_frequency( $post->ID ), $value, false ),
				$key
			);
		}
		echo '</select></td></tr>'
		. '</tbody></table>';
	}