1 | <?php |
---|
2 | class test35591 { |
---|
3 | private $_counter = 0; |
---|
4 | public function __construct() { |
---|
5 | add_action( 'init', array( $this, 'init' ) ); |
---|
6 | add_action( 'admin_notices', array( $this, 'admin_notices' ) ); |
---|
7 | } |
---|
8 | |
---|
9 | public function init() { |
---|
10 | add_shortcode( 'expert_profile', array( $this, 'test_35591' ) ); |
---|
11 | } |
---|
12 | |
---|
13 | public function admin_notices() { |
---|
14 | echo do_shortcode( '[expert_profile mode="desktop" expert="142"]' ); |
---|
15 | } |
---|
16 | |
---|
17 | public function test_35591( $attrs = array(), $content = null ) { |
---|
18 | $return = '<h2>$attrs - before</h2>' . print_r( $attrs, true ); |
---|
19 | $attrs = shortcode_atts( array( |
---|
20 | 'mode' => 'desktop', |
---|
21 | 'expert' => '0', |
---|
22 | 'num_to_show' => '25', |
---|
23 | 'tooltip' => 'on' |
---|
24 | |
---|
25 | ), $attrs ); |
---|
26 | $return .= '<h2>$attrs - after</h2>' . print_r( $attrs, true ); |
---|
27 | extract( $attrs ); |
---|
28 | foreach ( $attrs as $name => $value ) { |
---|
29 | $return .= '<h2>' . esc_html( $name ) . '</h2>' . print_r( ${$name}, true ); |
---|
30 | } |
---|
31 | return $return; |
---|
32 | } |
---|
33 | } |
---|
34 | |
---|
35 | new test35591; |
---|