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

meta_box_html_prices


Description Description

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


Top ↑

Parameters Parameters

$post

(WP_Post) (Required)

$meta_box

(mixed) (Required)


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/class-customize-admin-dashboard.php

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

		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="%s">%s</label></th>'
				. '<td><input type="text" name="%s" value="%s" onkeypress="return is_number(event)"></td></tr>',
				$meta_key,
				$label,
				$meta_key,
				INVP::get_meta( $key, $post->ID )
			);
		}

		//Payment frequency is a drop-down
		printf(
			'<tr><th scope="row"><label for="%s">Payment frequency</label></th>'
			. '<td><select name="%s"><option></option>',
			$meta_key,
			$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>';
	}