PluginProbe
Themebeez Toolkit / trunk
Themebeez Toolkit vtrunk
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 1.2.3 All 34 releases
themebeez-toolkit / includes / functions.php

functions.php in Themebeez Toolkit trunk, at includes/functions.php

138 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Theme related functions.
4 * Fires theme notice and setup theme configuration for theme page.
5 *
6 * @since 1.0.0
7 *
8 * @package Themebeez_Toolkit
9 */
10
11 if ( ! function_exists( 'themebeez_toolkit_theme' ) ) {
12 /**
13 * Returns currently activated theme.
14 *
15 * @since 1.0.0
16 */
17 function themebeez_toolkit_theme() {
18
19 $theme = wp_get_theme();
20
21 return $theme;
22 }
23 }
24
25
26 /**
27 * Function that gets text-domain of currently activated theme.
28 */
29 if ( ! function_exists( 'themebeez_toolkit_theme_text_domain' ) ) {
30 /**
31 * Gets the text domain of currently activated theme.
32 *
33 * @since 1.0.0
34 */
35 function themebeez_toolkit_theme_text_domain() {
36
37 $theme = themebeez_toolkit_theme();
38
39 $theme_text_domain = $theme->get( 'TextDomain' );
40
41 return $theme_text_domain;
42 }
43 }
44
45
46 if ( ! function_exists( 'themebeez_toolkit_template_name' ) ) {
47 /**
48 * Gets the name of currently activated theme.
49 *
50 * @since 1.0.0
51 */
52 function themebeez_toolkit_template_name() {
53
54 $theme = themebeez_toolkit_theme();
55
56 $template = $theme->get( 'Template' );
57
58 return $template;
59 }
60 }
61
62 /**
63 * Function that gets all the themes by themebeez.
64 */
65 if ( ! function_exists( 'themebeez_toolkit_theme_array' ) ) {
66 /**
67 * Definition of supported themes by toolkit.
68 *
69 * @since 1.0.0
70 */
71 function themebeez_toolkit_theme_array() {
72
73 return array( 'royale-news', 'cream-blog', 'royale-news-pro', 'cream-blog-pro', 'styleblog-plus', 'cream-magazine', 'cream-magazine-pro', 'fascinate', 'fascinate-pro', 'orchid-store' );
74 }
75 }
76
77
78 /**
79 * Function to load theme info
80 */
81 if ( ! function_exists( 'themebeez_toolkit_theme_info_demo_loader' ) ) {
82 /**
83 * Displays admin notice and loads configuration for theme page.
84 *
85 * @since 1.0.0
86 */
87 function themebeez_toolkit_theme_info_demo_loader() {
88
89 $theme_text_domain = themebeez_toolkit_theme_text_domain();
90
91 if ( ! in_array( $theme_text_domain, themebeez_toolkit_theme_array(), true ) ) {
92 return;
93 }
94
95 require_once plugin_dir_path( __FILE__ ) . 'theme-info/configs/' . $theme_text_domain . '-config.php';
96 }
97 }
98
99 add_action( 'themebeez_toolkit_load_theme_info_demo', 'themebeez_toolkit_theme_info_demo_loader' );
100
101
102 if ( ! function_exists( 'themebeez_toolkit_init_simple_mega_menu' ) ) {
103 /**
104 * Initialize simple mega menu for Orchid Store theme and its child themes.
105 *
106 * @since 1.0.0
107 */
108 function themebeez_toolkit_init_simple_mega_menu() {
109
110 $current_active_theme = wp_get_theme();
111
112 if (
113 'orchid-store' === $current_active_theme->get( 'TextDomain' ) ||
114 'orchid-store' === $current_active_theme->get( 'Template' )
115 ) {
116
117 require_once plugin_dir_path( __FILE__ ) . 'simple-mega-menu/class-simple-mega-menu-walker-filter.php';
118
119 require_once plugin_dir_path( __FILE__ ) . 'simple-mega-menu/class-simple-mega-menu-nav-walker.php';
120
121 add_filter(
122 'wp_nav_menu_args',
123 function ( $args ) {
124
125 return array_merge(
126 $args,
127 array(
128 'walker' => new Simple_Mega_Menu_Nav_Walker(),
129 )
130 );
131 }
132 );
133 }
134 }
135
136 add_action( 'init', 'themebeez_toolkit_init_simple_mega_menu' );
137 }
138