WPCF7_ContactForm::shortcode()publicCF7 1.0

Returns a WordPress shortcode for this contact form.

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

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

Возвращает

null. Ничего.

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

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

Код WPCF7_ContactForm::shortcode() CF7 5.6.1

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$d" title="%2$s"]',
			$this->id,
			$title
		);
	}

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