@@ -2,18 +2,18 @@ discard block |
||
2 | 2 | /** |
3 | 3 | * Add scripts to the plugin. CSS and JS. |
4 | 4 | */ |
5 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
5 | +if ( ! defined('ABSPATH')) exit; |
|
6 | 6 | |
7 | -if ( ! class_exists( 'PLUGIN_SCRIPT' ) ) { |
|
7 | +if ( ! class_exists('PLUGIN_SCRIPT')) { |
|
8 | 8 | |
9 | 9 | final class PLUGIN_SCRIPT { |
10 | 10 | |
11 | 11 | |
12 | 12 | public function __construct() { |
13 | 13 | |
14 | - add_action( 'admin_head', array( $this, 'data_table_css' ) ); |
|
15 | - add_action( 'admin_enqueue_scripts', array( $this, 'backend_scripts' ) ); |
|
16 | - add_action( 'wp_enqueue_scripts', array( $this, 'frontend_scripts' ) ); |
|
14 | + add_action('admin_head', array($this, 'data_table_css')); |
|
15 | + add_action('admin_enqueue_scripts', array($this, 'backend_scripts')); |
|
16 | + add_action('wp_enqueue_scripts', array($this, 'frontend_scripts')); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | // Set condition to add script |
40 | 40 | // if ( ! isset( $_GET['page'] ) || $_GET['page'] != 'pageName' ) return; |
41 | 41 | |
42 | - wp_enqueue_script( 'jsName', PLUGIN_JS . 'ui.js', array() ); |
|
43 | - wp_enqueue_style( 'cssName', PLUGIN_CSS . 'css.css' ); |
|
42 | + wp_enqueue_script('jsName', PLUGIN_JS . 'ui.js', array()); |
|
43 | + wp_enqueue_style('cssName', PLUGIN_CSS . 'css.css'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | // Enter scripts into pages |
49 | 49 | public function frontend_scripts() { |
50 | 50 | |
51 | - wp_enqueue_script( 'jsName', PLUGIN_JS . 'ui.js', array() ); |
|
52 | - wp_enqueue_style( 'cssName', PLUGIN_CSS . 'css.css' ); |
|
51 | + wp_enqueue_script('jsName', PLUGIN_JS . 'ui.js', array()); |
|
52 | + wp_enqueue_style('cssName', PLUGIN_CSS . 'css.css'); |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | } ?> |
@@ -30,7 +30,7 @@ |
||
30 | 30 | // The Loop |
31 | 31 | if ( $the_query->have_posts() ) { |
32 | 32 | while ( $the_query->have_posts() ) { |
33 | - $the_query->the_post(); |
|
33 | + $the_query->the_post(); |
|
34 | 34 | // Do Stuff |
35 | 35 | } // end while |
36 | 36 | } // endif |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
2 | +if ( ! defined('ABSPATH')) exit; |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * WP Query class for querying WP database |
6 | 6 | * For more reference of arguments visit: https://gist.github.com/nirjharlo/5c6f8ac4cc5271f88376788e599c287b |
7 | 7 | * This class depends on WP pagenavi plugin: https://wordpress.org/plugins/wp-pagenavi/ |
8 | 8 | */ |
9 | -if ( ! class_exists( 'PLUGIN_QUERY' ) ) { |
|
9 | +if ( ! class_exists('PLUGIN_QUERY')) { |
|
10 | 10 | |
11 | 11 | class PLUGIN_QUERY { |
12 | 12 | |
@@ -25,18 +25,18 @@ discard block |
||
25 | 25 | |
26 | 26 | $args = $this->user_args($paged); // OR $this->post_args($paged) |
27 | 27 | |
28 | - $the_query = new WP_Query( $args ); |
|
28 | + $the_query = new WP_Query($args); |
|
29 | 29 | |
30 | 30 | // The Loop |
31 | - if ( $the_query->have_posts() ) { |
|
32 | - while ( $the_query->have_posts() ) { |
|
31 | + if ($the_query->have_posts()) { |
|
32 | + while ($the_query->have_posts()) { |
|
33 | 33 | $the_query->the_post(); |
34 | 34 | // Do Stuff |
35 | 35 | } // end while |
36 | 36 | } // endif |
37 | 37 | |
38 | - if (function_exists('wp_pagenavi')) { |
|
39 | - wp_pagenavi( array( 'query' => $the_query, 'echo' => true ) );//For user query add param 'type' => 'users' |
|
38 | + if (function_exists('wp_pagenavi')) { |
|
39 | + wp_pagenavi(array('query' => $the_query, 'echo' => true)); //For user query add param 'type' => 'users' |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | // Reset Post Data |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function user_args($paged) { |
51 | 51 | |
52 | - $offset = ( $paged - 1 ) * $this->display_count; |
|
52 | + $offset = ($paged - 1) * $this->display_count; |
|
53 | 53 | |
54 | - $args = array ( |
|
54 | + $args = array( |
|
55 | 55 | 'role' => '', // user role |
56 | 56 | 'order' => '', //ASC or DESC |
57 | 57 | 'fields' => '', // |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | 'count_total' => true, |
68 | 68 | 'paged' => $paged, |
69 | 69 | 'offset' => $offset, |
70 | - 'search' => '*'.esc_attr( $_GET['search'] ).'*', |
|
70 | + 'search' => '*' . esc_attr($_GET['search']) . '*', |
|
71 | 71 | 'meta_query' => array( // It supports nested meta query |
72 | 72 | 'relation' => 'AND', //or 'OR' |
73 | 73 | array( |
@@ -92,9 +92,9 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function post_args($paged) { |
94 | 94 | |
95 | - $offset = ( $paged - 1 ) * $this->display_count; |
|
95 | + $offset = ($paged - 1) * $this->display_count; |
|
96 | 96 | |
97 | - $args = array ( |
|
97 | + $args = array( |
|
98 | 98 | 'post_type' => '', // array of type slugs |
99 | 99 | 'order' => 'ASC', |
100 | 100 | 'fields' => '', // |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | 'count_total' => true, |
109 | 109 | 'paged' => $paged, |
110 | 110 | 'offset' => $offset, |
111 | - 'search' => '*'.esc_attr( $_GET['search'] ).'*', |
|
111 | + 'search' => '*' . esc_attr($_GET['search']) . '*', |
|
112 | 112 | 'meta_query' => array( // It supports nested meta query |
113 | 113 | 'relation' => 'AND', //or 'OR' |
114 | 114 | array( |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
3 | + exit; |
|
4 | +} |
|
3 | 5 | |
4 | 6 | /** |
5 | 7 | * WP Query class for querying WP database |