| 1 |
<?php |
| 2 |
/** |
| 3 |
* The public-facing functionality of the module. |
| 4 |
* |
| 5 |
* @link https://codesupply.co |
| 6 |
* @since 1.0.0 |
| 7 |
* |
| 8 |
* @package Powerkit |
| 9 |
* @subpackage Modules/public |
| 10 |
*/ |
| 11 |
|
| 12 |
/** |
| 13 |
* The public-facing functionality of the module. |
| 14 |
*/ |
| 15 |
class Powerkit_Posts_Public extends Powerkit_Module_Public { |
| 16 |
/** |
| 17 |
* Initialize |
| 18 |
*/ |
| 19 |
public function initialize() { |
| 20 |
add_filter( 'powerkit_pinit_exclude_selectors', array( $this, 'pinit_disable' ) ); |
| 21 |
add_action( 'init', array( $this, 'register_templates' ) ); |
| 22 |
add_filter( 'powerkit_featured_posts_templates', array( $this, 'list_templates' ) ); |
| 23 |
} |
| 24 |
|
| 25 |
/** |
| 26 |
* PinIt disable |
| 27 |
* |
| 28 |
* @param string $selectors List selectors. |
| 29 |
*/ |
| 30 |
public function pinit_disable( $selectors ) { |
| 31 |
$selectors[] = '.pk-block-posts'; |
| 32 |
|
| 33 |
return $selectors; |
| 34 |
} |
| 35 |
|
| 36 |
/** |
| 37 |
* Register Templates |
| 38 |
* |
| 39 |
* @since 1.0.0 |
| 40 |
* @access private |
| 41 |
* |
| 42 |
* @param array $templates List of Templates. |
| 43 |
*/ |
| 44 |
public function register_templates( $templates = array() ) { |
| 45 |
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/posts-template.php'; |
| 46 |
} |
| 47 |
|
| 48 |
/** |
| 49 |
* Filter Register Templates |
| 50 |
* |
| 51 |
* @since 1.0.0 |
| 52 |
* @access private |
| 53 |
* |
| 54 |
* @param array $templates List of Templates. |
| 55 |
*/ |
| 56 |
public function list_templates( $templates = array() ) { |
| 57 |
$templates = array( |
| 58 |
'list' => array( |
| 59 |
'name' => esc_html__( 'Simple List', 'powerkit' ), |
| 60 |
'func' => 'powerkit_featured_posts_default_template', |
| 61 |
), |
| 62 |
'numbered' => array( |
| 63 |
'name' => esc_html__( 'Numbered List', 'powerkit' ), |
| 64 |
'func' => 'powerkit_featured_posts_default_template', |
| 65 |
), |
| 66 |
'large' => array( |
| 67 |
'name' => esc_html__( 'Large Thumbnails', 'powerkit' ), |
| 68 |
'func' => 'powerkit_featured_posts_default_template', |
| 69 |
), |
| 70 |
); |
| 71 |
|
| 72 |
return $templates; |
| 73 |
} |
| 74 |
|
| 75 |
/** |
| 76 |
* Register the stylesheets for the public-facing side of the site. |
| 77 |
*/ |
| 78 |
public function wp_enqueue_scripts() { |
| 79 |
wp_enqueue_style( 'powerkit-widget-posts', powerkit_style( plugin_dir_url( __FILE__ ) . 'css/public-powerkit-widget-posts.css' ), array(), powerkit_get_setting( 'version' ), 'all' ); |
| 80 |
|
| 81 |
// Add RTL support. |
| 82 |
wp_style_add_data( 'powerkit-widget-posts', 'rtl', 'replace' ); |
| 83 |
} |
| 84 |
} |
| 85 |
|