Kadence Themes Toolkit - Version 2.9

Version Description

  • Add: permalink flush, update for feeds link.
  • Add: Filter for permalink struture.
  • Add: Better Plugin Description.
  • Fix: Templater error on 404 pages.
Download this release

Release Info

Developer britner
Plugin Icon wp plugin Kadence Themes Toolkit
Version 2.9
Comparing to
See all releases

Code changes from version 2.8 to 2.9

Files changed (4) hide show
  1. pagetemplater.php +4 -0
  2. post-types.php +73 -2
  3. readme.txt +30 -3
  4. virtue_toolkit.php +14 -2
pagetemplater.php CHANGED
@@ -62,6 +62,8 @@ class Kadence_Page_Templater_Pinnacle {
62
 
63
  global $post;
64
 
 
 
65
  if (!isset($this->templates[get_post_meta( $post->ID, '_wp_page_template', true )] ) ) {
66
 
67
  return $template;
@@ -148,6 +150,8 @@ class Kadence_Page_Templater_Virtue {
148
 
149
  global $post;
150
 
 
 
151
  if (!isset($this->templates[get_post_meta( $post->ID, '_wp_page_template', true )] ) ) {
152
 
153
  return $template;
62
 
63
  global $post;
64
 
65
+ if ( !isset( $post ) ) return $template;
66
+
67
  if (!isset($this->templates[get_post_meta( $post->ID, '_wp_page_template', true )] ) ) {
68
 
69
  return $template;
150
 
151
  global $post;
152
 
153
+ if ( !isset( $post ) ) return $template;
154
+
155
  if (!isset($this->templates[get_post_meta( $post->ID, '_wp_page_template', true )] ) ) {
156
 
157
  return $template;
post-types.php CHANGED
@@ -24,7 +24,7 @@ function kad_portfolio_post_init() {
24
  'show_ui' => true,
25
  'show_in_menu' => true,
26
  'query_var' => true,
27
- 'rewrite' => array( 'slug' => 'portfolio' ), /* you can specify its url slug */
28
  'has_archive' => false,
29
  'capability_type' => 'post',
30
  'hierarchical' => false,
@@ -57,4 +57,75 @@ function kad_portfolio_post_init() {
57
  register_post_type( 'portfolio', $portargs );
58
  }
59
  add_action( 'init', 'kad_portfolio_post_init', 1 );
60
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  'show_ui' => true,
25
  'show_in_menu' => true,
26
  'query_var' => true,
27
+ //'rewrite' => array( 'slug' => 'portfolio', 'feeds' => true),
28
  'has_archive' => false,
29
  'capability_type' => 'post',
30
  'hierarchical' => false,
57
  register_post_type( 'portfolio', $portargs );
58
  }
59
  add_action( 'init', 'kad_portfolio_post_init', 1 );
60
+ function kad_portfolio_permalink_init(){
61
+ global $wp_rewrite;
62
+ $port_rewrite = apply_filters('kadence_portfolio_permalink_slug', 'portfolio');
63
+ $portfolio_structure = '/'.$port_rewrite.'/%portfolio%';
64
+ $wp_rewrite->add_rewrite_tag("%portfolio%", '([^/]+)', "portfolio=");
65
+ $wp_rewrite->add_permastruct('portfolio', $portfolio_structure, false);
66
+ }
67
+ add_action( 'init', 'kad_portfolio_permalink_init', 2 );
68
+
69
+ // Add filter to plugin init function
70
+ add_filter('post_type_link', 'kad_portfolio_permalink', 10, 3);
71
+
72
+ function kad_portfolio_permalink($permalink, $post_id, $leavename) {
73
+ $post = get_post($post_id);
74
+ $rewritecode = array(
75
+ '%year%',
76
+ '%monthnum%',
77
+ '%day%',
78
+ '%hour%',
79
+ '%minute%',
80
+ '%second%',
81
+ $leavename? '' : '%postname%',
82
+ '%post_id%',
83
+ '%category%',
84
+ '%author%',
85
+ $leavename? '' : '%pagename%',
86
+ );
87
+
88
+ if ( '' != $permalink && !in_array($post->post_status, array('draft', 'pending', 'auto-draft')) ) {
89
+ $unixtime = strtotime($post->post_date);
90
+
91
+ $category = '';
92
+ if ( strpos($permalink, '%category%') !== false ) {
93
+ $cats = wp_get_post_terms($post->ID, 'portfolio-type', array( 'orderby' => 'parent', 'order' => 'DESC' ));
94
+ if ( $cats ) {
95
+ //usort($cats, '_usort_terms_by_ID'); // order by ID
96
+ $category = $cats[0]->slug;
97
+ }
98
+ // show default category in permalinks, without
99
+ // having to assign it explicitly
100
+ if ( empty($category) ) {
101
+ $category = 'portfolio-category';
102
+ }
103
+ }
104
+
105
+ $author = '';
106
+ if ( strpos($permalink, '%author%') !== false ) {
107
+ $authordata = get_userdata($post->post_author);
108
+ $author = $authordata->user_nicename;
109
+ }
110
+
111
+ $date = explode(" ",date('Y m d H i s', $unixtime));
112
+ $rewritereplace =
113
+ array(
114
+ $date[0],
115
+ $date[1],
116
+ $date[2],
117
+ $date[3],
118
+ $date[4],
119
+ $date[5],
120
+ $post->post_name,
121
+ $post->ID,
122
+ $category,
123
+ $author,
124
+ $post->post_name,
125
+ );
126
+ $permalink = str_replace($rewritecode, $rewritereplace, $permalink);
127
+ } else { // if they're not using the fancy permalink option
128
+ }
129
+ return $permalink;
130
+ }
131
+
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: britner
3
  Tags:
4
  Requires at least: 3.5
5
- Tested up to: 4.1
6
- Stable tag: 2.8
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -11,10 +11,31 @@ Custom Portfolio and Shortcode functionality for Virtue and Pinnacle Wordpress T
11
 
12
  == Description ==
13
 
14
- Custom Portfolio and Shortcode functionality for Virtue and Pinnacle Wordpress Theme
15
 
16
  Not intended to work with any other themes.
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  == Installation ==
19
 
20
  Install the plugin into the `/wp-content/plugins/` folder, and activate it.
@@ -22,6 +43,12 @@ Install the plugin into the `/wp-content/plugins/` folder, and activate it.
22
 
23
  == Changelog ==
24
 
 
 
 
 
 
 
25
  = 2.8 =
26
  * Add fix for some servers not loading correctly.
27
  * Add filter to only show slider images on feature templates.
2
  Contributors: britner
3
  Tags:
4
  Requires at least: 3.5
5
+ Tested up to: 4.2
6
+ Stable tag: 2.9
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
11
 
12
  == Description ==
13
 
14
+ Custom Portfolio and Shortcode functionality for Virtue and Pinnacle Wordpress Themes, by Kadence Themes
15
 
16
  Not intended to work with any other themes.
17
 
18
+ = Features =
19
+ * **Included Shortcodes**
20
+ - Columns
21
+ - Dividers
22
+ - Accordions
23
+ - Tabs
24
+ - Quotes and Block Quotes
25
+ - Buttons
26
+ - Icons
27
+ - Responsive Youtube
28
+ - Responsive Vimeo
29
+
30
+ * **Portfolio Post Type** - included metabox options for post sliders and three post layout options.
31
+
32
+ * **Contact Form Page Template** - includes page template that has options for a google map and a contact form.
33
+
34
+ * **Gallery Styling for Wordpress Gallery** - this allows the Kadence Theme to override the wordpress gallery with theme specific styling. You can turn this off in the theme options > misc settings.
35
+
36
+ * **Gallery Metaboxs for post and pages** - allows for a gallery to be added to a post for a post slider or page for page slider using the featured template.
37
+
38
+
39
  == Installation ==
40
 
41
  Install the plugin into the `/wp-content/plugins/` folder, and activate it.
43
 
44
  == Changelog ==
45
 
46
+ = 2.9 =
47
+ * Add: permalink flush, update for feeds link.
48
+ * Add: Filter for permalink struture.
49
+ * Add: Better Plugin Description.
50
+ * Fix: Templater error on 404 pages.
51
+
52
  = 2.8 =
53
  * Add fix for some servers not loading correctly.
54
  * Add filter to only show slider images on feature templates.
virtue_toolkit.php CHANGED
@@ -3,12 +3,15 @@
3
  /*
4
  Plugin Name: Virtue / Pinnacle ToolKit
5
  Description: Custom Portfolio and Shortcode functionality for Virtue and Pinnacle Wordpress Theme
6
- Version: 2.8
7
  Author: Kadence Themes
8
  Author URI: http://kadencethemes.com/
9
  License: GPLv2 or later
10
  */
11
  function virtue_toolkit_activation() {
 
 
 
12
  }
13
  register_activation_hook(__FILE__, 'virtue_toolkit_activation');
14
 
@@ -40,4 +43,13 @@ function kadencetoolkit_admin_scripts() {
40
 
41
  }
42
 
43
- add_action('admin_enqueue_scripts', 'kadencetoolkit_admin_scripts');
 
 
 
 
 
 
 
 
 
3
  /*
4
  Plugin Name: Virtue / Pinnacle ToolKit
5
  Description: Custom Portfolio and Shortcode functionality for Virtue and Pinnacle Wordpress Theme
6
+ Version: 2.9
7
  Author: Kadence Themes
8
  Author URI: http://kadencethemes.com/
9
  License: GPLv2 or later
10
  */
11
  function virtue_toolkit_activation() {
12
+ kad_portfolio_post_init();
13
+ flush_rewrite_rules();
14
+ get_option('kadence_toolkit_flushpermalinks', '1');
15
  }
16
  register_activation_hook(__FILE__, 'virtue_toolkit_activation');
17
 
43
 
44
  }
45
 
46
+ add_action('admin_enqueue_scripts', 'kadencetoolkit_admin_scripts');
47
+
48
+ function kadence_toolkit_flushpermalinks() {
49
+ $hasflushed = get_option('kadence_toolkit_flushpermalinks', '0');
50
+ if($hasflushed != '1') {
51
+ flush_rewrite_rules();
52
+ update_option('kadence_toolkit_flushpermalinks', '1');
53
+ }
54
+ }
55
+ add_action('init', 'kadence_toolkit_flushpermalinks');