WPCF7_ContactForm::shortcode()publicCF7 1.0

Returns a WordPress shortcode for this contact form.

Метод класса: WPCF7_ContactForm{}

Хуки из метода

Возвращает

null. Ничего (null).

Использование

$WPCF7_ContactForm = new WPCF7_ContactForm();
$WPCF7_ContactForm->shortcode( $args );
$args **
-
По умолчанию: ''

Код WPCF7_ContactForm::shortcode() CF7 5.9.3

public function shortcode( $args = '' ) {
	$args = wp_parse_args( $args, array(
		'use_old_format' => false
	) );

	$title = str_replace( array( '"', '[', ']' ), '', $this->title );

	if ( $args['use_old_format'] ) {
		$old_unit_id = (int) get_post_meta( $this->id, '_old_cf7_unit_id', true );

		if ( $old_unit_id ) {
			$shortcode = sprintf(
				'[contact-form %1$d "%2$s"]',
				$old_unit_id,
				$title
			);
		} else {
			$shortcode = '';
		}
	} else {
		$shortcode = sprintf(
			'[contact-form-7 id="%1$s" title="%2$s"]',
			$this->hash(),
			$title
		);
	}

	return apply_filters( 'wpcf7_contact_form_shortcode',
		$shortcode, $args, $this
	);
}