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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
<?php if ( ! defined( 'ABSPATH' ) ) { exit; } if( ! class_exists( 'Penci_Gutenberg_Related_Posts' ) ): class Penci_Gutenberg_Related_Posts {
public function render( $attributes, $content ) { $param = ' wpblock="true"'; if( $attributes ){ foreach ( (array)$attributes as $k => $v ){ if( $v ){ if( 'thumbright' == $k && $v ){ $v = 'yes'; } $param .= ' ' . $k . '="' . $v . '"'; } } }
return do_shortcode( '[penci_related_posts' . $param . ']' ); } public function attributes() { $options = array( 'title' => array( 'type' => 'string', 'default' => esc_html__( 'Inline Related Posts','penci-framework' ), ), 'number' => array( 'type' => 'number', 'default' => '4', ), 'style' => array( 'type' => 'string', 'default' => 'list', ), 'align' => array( 'type' => 'string', 'default' => 'none', ), 'withids' => array( 'type' => 'string', ), 'displayby' => array( 'type' => 'string', 'default' => 'recent_posts', ), 'orderby' => array( 'type' => 'string', 'default' => 'random', ), 'thumbright' => array( 'type' => 'boolean', 'default' => false, ), 'background' => array( 'type' => 'string', ), 'border' => array( 'type' => 'string', ) );
return $options; } } endif;
|