Sid Gifari File Manager
π Root
/
home
/
genremedia08
/
thepassage.overlookedtracks.com
/
wp-content9
/
plugins
/
democracy-poll
/
classes
/
Editing: Shortcodes.php
<?php namespace DemocracyPoll; class Shortcodes { public function __construct(){ } public function init(): void { add_shortcode( 'democracy', [ $this, 'democracy_shortcode' ] ); add_shortcode( 'democracy_archives', [ $this, 'democracy_archives_shortcode' ] ); } public function democracy_archives_shortcode( $args ): string { $args = shortcode_atts( [ 'before_title' => '', 'after_title' => '', 'active' => null, // 1 (active), 0 (not active) or null (param not set). 'open' => null, // 1 (opened), 0 (closed) or null (param not set) polls. 'screen' => 'voted', 'per_page' => 10, 'add_from_posts' => true, // add From posts: html block 'orderby' => '', // string|array - [ 'open' => 'ASC' ] | 'open' | rand ], $args ); return '<div class="dem-archives-shortcode">' . get_democracy_archives( $args ) . '</div>'; } public function democracy_shortcode( $atts ): string { $atts = shortcode_atts( [ 'id' => '', // number or 'current', 'last' // 'before_title' => '', // IMP! can't be added - security reason // 'after_title' => '', // IMP! can't be added - security reason ], $atts, 'democracy' ); // Π΄Π»Ρ ΠΎΠΏΡΠ΅Π΄Π»Π΅Π½ΠΈΡ ΠΊ ΠΊΠ°ΠΊΠΎΠΉ Π·Π°ΠΏΠΈΡΠΈ ΠΎΡΠ½ΠΎΡΠΈΡΡΡΡ ΠΎΠΏΡΠΎΡ. ΠΏΡΠΎΠ²Π΅ΡΠΊΠ°, Π΅ΡΠ»ΠΈ ΡΠΎΡΡΠΊΠΎΠ΄ Π²ΡΠ·Π²Π°Π½ Π½Π΅ ΠΈΠ· ΠΊΠΎΠ½ΡΠ΅Π½ΡΠ°... $post_id = ( is_singular() && is_main_query() ) ? $GLOBALS['post']->ID : 0; if( $atts['id'] === 'current' ){ $atts['id'] = \DemocracyPoll\Admin\Post_Metabox::get_post_poll_id( $post_id ); } return '<div class="dem-poll-shortcode">' . get_democracy_poll( $atts['id'], '', '', $post_id ) . '</div>'; } }
Save
Cancel