WPCF7_ContactForm::shortcode
Returns a WordPress shortcode for this contact form.
Метод класса: WPCF7_ContactForm{}
Хуки из метода
Возвращает
null. Ничего (null).
Использование
$WPCF7_ContactForm = new WPCF7_ContactForm(); $WPCF7_ContactForm->shortcode( $options );
- $options
- .
По умолчанию:''
Код WPCF7_ContactForm::shortcode() WPCF7 ContactForm::shortcode CF7 6.1.5
public function shortcode( $options = '' ) {
$options = wp_parse_args( $options, array(
'use_old_format' => false
) );
$title = str_replace( array( '"', '[', ']' ), '', $this->title );
if ( $options['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, $options, $this
);
}