PluginProbe
Essential Widgets / 2.2
Essential Widgets v2.2
3.2.1 3.3 3.2 trunk 1.0.0 1.0.1 1.1 1.2 1.2.1 1.2.2 1.3 1.4 1.4.1 1.5 1.6 1.7 1.7.1 1.7.2 1.7.3 1.7.4 1.8 1.9 2.0 2.1 2.2 All 31 releases
essential-widgets / includes / ew-block / blocks / ew-archive / index.php

index.php in Essential Widgets 2.2, at includes/ew-block/blocks/ew-archive/index.php

74 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // Hook the post rendering to the block
4 if ( function_exists( 'register_block_type' ) ) :
5 register_block_type(
6 'ew-block/ew-archive',
7 array(
8 'attributes' => array(
9 'title' => array(
10 'type' => 'string',
11 'default' => 'Archives',
12 ),
13 'limit' => array(
14 'type' => 'number',
15 'default' => 10,
16 ),
17 'type' => array(
18 'type' => 'string',
19 'default' => 'monthly',
20 ),
21 'post_type' => array(
22 'type' => 'string',
23 'default' => 'post',
24 ),
25 'order' => array(
26 'type' => 'string',
27 'default' => 'asc',
28 ),
29 'format' => array(
30 'type' => 'string',
31 'default' => 'html',
32 ),
33 'before' => array(
34 'type' => 'string',
35 'default' => '',
36 ),
37 'after' => array(
38 'type' => 'string',
39 'default' => '',
40 ),
41 'show_post_count' => array(
42 'type' => 'boolean',
43 'default' => false,
44 ),
45 'is_block' => array(
46 'type' => 'boolean',
47 'default' => true,
48 ),
49 ),
50 'render_callback' => 'ew_archive_render_shortcode',
51 )
52 );
53 endif;
54
55 if ( ! function_exists( 'ew_archive_render_shortcode' ) ) :
56 add_shortcode( 'ew-archive', 'ew_archive_render_shortcode' );
57 function ew_archive_render_shortcode( $atts ) {
58 $instance['title'] = $atts['title'];
59 $instance['limit'] = $atts['limit'];
60 $instance['type'] = $atts['type'];
61 $instance['post_type'] = $atts['post_type'];
62 $instance['order'] = $atts['order'];
63 $instance['format'] = $atts['format'];
64 $instance['before'] = $atts['before'];
65 $instance['after'] = $atts['after'];
66 $instance['show_post_count'] = $atts['show_post_count'];
67 $instance['is_block'] = $atts['is_block'];
68
69 $ew_archive = new EW_Archives();
70
71 return $ew_archive->shortcode( $instance );
72 }
73 endif;
74