-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlcb_slides.php
52 lines (42 loc) · 1.45 KB
/
lcb_slides.php
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
<?php
/*
* Plugin Name: LCB Slides
* Description: Simple slides management for wordpress
* Version: 1.1.0
* Author: Tomasz Gregorczyk
* License: GPL2
*/
include(dirname(__FILE__) . '/core/admin.php');
include(dirname(__FILE__) . '/core/widget.php');
new LCB_Slides('flexslider');
new LCB_Slides_Admin;
new LCB_Slides_Widget;
class LCB_Slides {
public function __construct($type = null) {
add_action('wp_enqueue_scripts', array($this, 'lcb_slides_styles'));
if ($type == "flexslider") {
add_action('wp_enqueue_scripts', array($this, 'lcb_slides_flexslider'));
}
}
public function lcb_slides_styles() {
$path = get_stylesheet_directory_uri() . '/includes/lcb_slides/';
wp_enqueue_style('slides', $path . 'slides.css');
}
public function lcb_slides_flexslider() {
$path = get_stylesheet_directory_uri() . '/includes/lcb_slides/extra/';
wp_enqueue_style('flexslider', $path . 'flexslider.css');
wp_enqueue_script('flexslider', plugins_url('extra/flexslider.js', __FILE__), array(), '1.0.0', true);
}
function getSlides() {
$args = array(
'post_type' => 'slide',
'post_parent' => 0
);
return get_posts($args);
}
function getSlide($slide) {
$slide->url = wp_get_attachment_url(get_post_thumbnail_id($slide->ID));
$slide->link = get_post_meta($slide->ID, '_slide_url', true);
return $slide;
}
}