写一篇有代码的测试文章
#可爱#大笑#呕吐#微笑
由于Contact form 7 轻量迷你且免费,所以很多功能的实现需要配合其他辅助插件使用
如下:(不提供插件下载,这些基本后台都可以搜索得到)
- Contact form 7 插件:Contact form 7
- 配合同步到MailChimp:Contact Form 7 Extension For Mailchimp
- 配合记录用户填写的表单:Contact Form CFDB7
- 配合提交后跳转url和链接传参:Redirection for Contact Form 7
- 配合弹窗插件:JetPopup (内附多套样式,便于参考或修改)
- 推荐好用的页面构建器: Elementor
创建完表单如何实现插入到页面呢?
非常简单,Contact form 7新建表单后会生成一串短代码,将短代码插入到文章相应位置即可。如下图:
当然,配合上边推荐的Elementor元素插件(页面构建器),可以通过Elementor内在模块快捷插入Contact form 7表单。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
class WP_Widget_Calendar extends WP_Widget { /** * Ensure that the ID attribute only appears in the markup once * * @since 4.4.0 * @var int */ private static $instance = 0; /** * Sets up a new Calendar widget instance. * * @since 2.8.0 */ public function __construct() { $widget_ops = array( 'classname' => 'widget_calendar', 'description' => __( 'A calendar of your site’s posts.' ), 'customize_selective_refresh' => true, ); parent::__construct( 'calendar', __( 'Calendar' ), $widget_ops ); } /** * Outputs the content for the current Calendar widget instance. * * @since 2.8.0 * * @param array $args Display arguments including 'before_title', 'after_title', * 'before_widget', and 'after_widget'. * @param array $instance The settings for the particular instance of the widget. */ public function widget( $args, $instance ) { $title = ! empty( $instance['title'] ) ? $instance['title'] : ''; /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); echo $args['before_widget']; if ( $title ) { echo $args['before_title'] . $title . $args['after_title']; } if ( 0 === self::$instance ) { echo '<div id="calendar_wrap" class="calendar_wrap">'; } else { echo '<div class="calendar_wrap">'; } get_calendar(); echo '</div>'; echo $args['after_widget']; self::$instance++; } |