Advertisement
rdusnr

Untitled

Oct 30th, 2017
409
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 50.54 KB | None | 0 0
  1. <?php
  2. /**
  3. * @package WordPress
  4. * @subpackage Next
  5. * @author SeventhQueen <themesupport@seventhqueen.com>
  6. * @since Next 1.0
  7. */
  8.  
  9. /***************************************************
  10. :: Load Kleo framework
  11. ***************************************************/
  12.  
  13. define( 'KLEO_THEME_VERSION', '1.5.2' );
  14.  
  15. if ( ! isset( $content_width ) ) {
  16. $content_width = 1200;
  17. }
  18.  
  19. require_once( trailingslashit( get_template_directory() ) . 'kleo-framework/kleo.php' );
  20.  
  21. //set some theme configuration options
  22. Kleo::init_config( array(
  23. 'styling_variables' => array(
  24. 'background-color' => esc_html__( 'Background color', 'buddyapp' ),
  25. 'border-color' => esc_html__( 'Border color', 'buddyapp' ),
  26. 'heading-color' => esc_html__( 'Heading color', 'buddyapp' ),
  27. 'text-color' => esc_html__( 'Text color', 'buddyapp' ),
  28. 'link-color' => esc_html__( 'Link color', 'buddyapp' ),
  29. 'hover-link-color' => esc_html__( 'Hover Link color', 'buddyapp' ),
  30. 'accent-color' => esc_html__( 'Accent color', 'buddyapp' )
  31. ),
  32. //Post image sizes for carousels and galleries
  33. 'post_gallery_img_width' => 600,
  34. 'post_gallery_img_height' => 400,
  35.  
  36. //page templates
  37. 'tpl_map' => array(
  38. 'page-templates/full-width.php' => 'full',
  39. 'page-templates/left-sidebar.php' => 'left',
  40. 'page-templates/right_sidebar.php' => 'right',
  41. ),
  42. 'container_class' => 'container-fluid',
  43. 'menu_icon_default' => 'buddyapp-default',
  44. 'footer_text' => 'Proudly powered by WordPress. Developed by <a target="_blank" href="http://7thqueen.com">SeventhQueen</a>',
  45. 'default_font_headings' => 'Montserrat',
  46. 'default_font_text' => 'Open Sans',
  47. 'blog_meta_defaults' => array( 'date', 'author_link', 'categories', 'tags', 'comments'),
  48. 'blog_meta_elements' => array(
  49. 'avatar' => 'Author Avatar',
  50. 'author_link' => 'Author name',
  51. 'date' => 'Date',
  52. 'message' => 'Message Link',
  53. 'categories' => 'Categories',
  54. 'tags' => 'Tags',
  55. 'comments' => 'Comments'
  56. )
  57.  
  58. ));
  59.  
  60.  
  61.  
  62.  
  63. /***************************************************
  64. :: Theme Required plugins
  65. ***************************************************/
  66.  
  67. add_action( 'tgmpa_register', 'kleo_required_plugins' );
  68.  
  69. function kleo_required_plugins() {
  70.  
  71. /**
  72. * Array of plugin arrays. Required keys are name and slug.
  73. * If the source is NOT from the .org repo, then source is also required.
  74. */
  75. $plugins = array(
  76. array(
  77. 'name' => 'BuddyPress', // The plugin name
  78. 'slug' => 'buddypress', // The plugin slug (typically the folder name)
  79. 'required' => false, // If false, the plugin is only 'recommended' instead of required
  80. 'version' => '2.3', // E.g. 1.0.0. If set, the active plugin must be this version or higher, otherwise a notice is presented
  81. 'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch
  82. 'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins
  83. 'external_url' => '', // If set, overrides default API URL and points to an external URL
  84. ),
  85. array(
  86. 'name' => 'bbPress', // The plugin name
  87. 'slug' => 'bbpress', // The plugin slug (typically the folder name)
  88. 'required' => false, // If false, the plugin is only 'recommended' instead of required
  89. 'version' => '', // E.g. 1.0.0. If set, the active plugin must be this version or higher, otherwise a notice is presented
  90. 'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch
  91. 'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins
  92. 'external_url' => '', // If set, overrides default API URL and points to an external URL
  93. ),
  94. array(
  95. 'name' => 'Envato Toolkit - Auto Theme Updates', // The plugin name
  96. 'slug' => 'envato-wordpress-toolkit', // The plugin slug (typically the folder name)
  97. 'source' => get_template_directory() . '/lib/inc/envato-wordpress-toolkit.zip', // The plugin source
  98. 'required' => true, // If false, the plugin is only 'recommended' instead of required
  99. 'version' => '', // E.g. 1.0.0. If set, the active plugin must be this version or higher, otherwise a notice is presented
  100. 'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch
  101. 'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins
  102. 'external_url' => '', // If set, overrides default API URL and points to an external URL
  103. ),
  104. array(
  105. 'name' => 'Visual Composer', // The plugin name
  106. 'slug' => 'js_composer', // The plugin slug (typically the folder name)
  107. 'source' => get_template_directory() . '/lib/inc/js_composer.zip', // The plugin source
  108. 'required' => true, // If false, the plugin is only 'recommended' instead of required
  109. 'version' => '5.2.1.', // E.g. 1.0.0. If set, the active plugin must be this version or higher, otherwise a notice is presented
  110. 'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch
  111. 'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins
  112. 'external_url' => '', // If set, overrides default API URL and points to an external URL
  113. ),
  114. array(
  115. 'name' => 'Restrict my Site', // The plugin name
  116. 'slug' => 'restrict-my-site', // The plugin slug (typically the folder name)
  117. 'source' => get_template_directory() . '/lib/inc/restrict-my-site.zip', // The plugin source
  118. 'required' => false, // If false, the plugin is only 'recommended' instead of required
  119. 'version' => '1.0.1', // E.g. 1.0.0. If set, the active plugin must be this version or higher, otherwise a notice is presented
  120. 'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch
  121. 'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins
  122. 'external_url' => '', // If set, overrides default API URL and points to an external URL
  123. ),
  124. array(
  125. 'name' => 'Easy Knowledge Base', // The plugin name
  126. 'slug' => 'easy-kb', // The plugin slug (typically the folder name)
  127. 'source' => get_template_directory() . '/lib/inc/easy-kb.zip', // The plugin source
  128. 'required' => false, // If false, the plugin is only 'recommended' instead of required
  129. 'version' => '1.0', // E.g. 1.0.0. If set, the active plugin must be this version or higher, otherwise a notice is presented
  130. 'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch
  131. 'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins
  132. 'external_url' => '', // If set, overrides default API URL and points to an external URL
  133. ),
  134. array(
  135. 'name' => 'rtMedia', // The plugin name
  136. 'slug' => 'buddypress-media', // The plugin slug (typically the folder name)
  137. 'required' => false, // If false, the plugin is only 'recommended' instead of required
  138. 'version' => '', // E.g. 1.0.0. If set, the active plugin must be this version or higher, otherwise a notice is presented
  139. 'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch
  140. 'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins
  141. 'external_url' => '', // If set, overrides default API URL and points to an external URL
  142. ),
  143. array(
  144. 'name' => 'Contact Form 7', // The plugin name
  145. 'slug' => 'contact-form-7', // The plugin slug (typically the folder name)
  146. 'required' => false, // If false, the plugin is only 'recommended' instead of required
  147. 'version' => '', // E.g. 1.0.0. If set, the active plugin must be this version or higher, otherwise a notice is presented
  148. 'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch
  149. 'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins
  150. 'external_url' => '', // If set, overrides default API URL and points to an external URL
  151. ),
  152. array(
  153. 'name' => 'Charts and Graphs', // The plugin name
  154. 'slug' => 'visualizer', // The plugin slug (typically the folder name)
  155. 'required' => false, // If false, the plugin is only 'recommended' instead of required
  156. 'version' => '', // E.g. 1.0.0. If set, the active plugin must be this version or higher, otherwise a notice is presented
  157. 'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch
  158. 'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins
  159. 'external_url' => '', // If set, overrides default API URL and points to an external URL
  160. ),
  161. array(
  162. 'name' => 'Wise Chat', // The plugin name
  163. 'slug' => 'wise-chat', // The plugin slug (typically the folder name)
  164. 'required' => false, // If false, the plugin is only 'recommended' instead of required
  165. 'version' => '', // E.g. 1.0.0. If set, the active plugin must be this version or higher, otherwise a notice is presented
  166. 'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch
  167. 'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins
  168. 'external_url' => '', // If set, overrides default API URL and points to an external URL
  169. ),
  170.  
  171. array(
  172. 'name' => 'BuddyDrive - File sharing', // The plugin name
  173. 'slug' => 'buddydrive', // The plugin slug (typically the folder name)
  174. 'required' => false, // If false, the plugin is only 'recommended' instead of required
  175. 'version' => '', // E.g. 1.0.0. If set, the active plugin must be this version or higher, otherwise a notice is presented
  176. 'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch
  177. 'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins
  178. 'external_url' => '', // If set, overrides default API URL and points to an external URL
  179. ),
  180. array(
  181. 'name' => 'WP Polls', // The plugin name
  182. 'slug' => 'wp-polls', // The plugin slug (typically the folder name)
  183. 'required' => false, // If false, the plugin is only 'recommended' instead of required
  184. 'version' => '', // E.g. 1.0.0. If set, the active plugin must be this version or higher, otherwise a notice is presented
  185. 'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch
  186. 'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins
  187. 'external_url' => '', // If set, overrides default API URL and points to an external URL
  188. ),
  189. array(
  190. 'name' => 'Events Manager', // The plugin name
  191. 'slug' => 'events-manager', // The plugin slug (typically the folder name)
  192. 'required' => false, // If false, the plugin is only 'recommended' instead of required
  193. 'version' => '', // E.g. 1.0.0. If set, the active plugin must be this version or higher, otherwise a notice is presented
  194. 'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch
  195. 'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins
  196. 'external_url' => '', // If set, overrides default API URL and points to an external URL
  197. ),
  198. array(
  199. 'name' => 'Cleverness To-Do List', // The plugin name
  200. 'slug' => 'cleverness-to-do-list', // The plugin slug (typically the folder name)
  201. 'required' => false, // If false, the plugin is only 'recommended' instead of required
  202. 'version' => '', // E.g. 1.0.0. If set, the active plugin must be this version or higher, otherwise a notice is presented
  203. 'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch
  204. 'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins
  205. 'external_url' => '', // If set, overrides default API URL and points to an external URL
  206. ),
  207.  
  208. );
  209.  
  210. /**
  211. * Array of configuration settings. Amend each line as needed.
  212. * If you want the default strings to be available under your own theme domain,
  213. * leave the strings uncommented.
  214. */
  215. $config = array(
  216. 'id' => 'tgmpa-kleo-' . KLEO_THEME_VERSION,
  217. //'domain' => $theme_text_domain, // Text domain - likely want to be the same as your theme.
  218. 'default_path' => '', // Default absolute path to pre-packaged plugins
  219. //'parent_slug' => '', // Default parent menu slug
  220. //'parent_url_slug' => 'themes.php', // Default parent URL slug
  221. 'menu' => 'install-required-plugins', // Menu slug
  222. 'has_notices' => true, // Show admin notices or not
  223. 'is_automatic' => true, // Automatically activate plugins after installation or not
  224. 'message' => '', // Message to output right before the plugins table
  225. 'strings' => array(
  226. 'page_title' => esc_html__( 'Install Required Plugins', 'buddyapp' ),
  227. 'menu_title' => esc_html__( 'Install Plugins', 'buddyapp' ),
  228. 'installing' => esc_html__( 'Installing Plugin: %s', 'buddyapp' ), // %1$s = plugin name
  229. 'oops' => esc_html__( 'Something went wrong with the plugin API.', 'buddyapp' ),
  230. 'notice_can_install_required' => _n_noop( 'This theme requires the following plugin: %1$s.', 'This theme requires the following plugins: %1$s.','buddyapp' ), // %1$s = plugin name(s)
  231. 'notice_can_install_recommended' => _n_noop( 'This theme recommends the following plugin: %1$s.', 'This theme recommends the following plugins: %1$s.','buddyapp' ), // %1$s = plugin name(s)
  232. 'notice_cannot_install' => _n_noop( 'Sorry, but you do not have the correct permissions to install the %s plugin. Contact the administrator of this site for help on getting the plugin installed.', 'Sorry, but you do not have the correct permissions to install the %s plugins. Contact the administrator of this site for help on getting the plugins installed.','buddyapp' ), // %1$s = plugin name(s)
  233. 'notice_can_activate_required' => _n_noop( 'The following required plugin is currently inactive: %1$s.', 'The following required plugins are currently inactive: %1$s.','buddyapp' ), // %1$s = plugin name(s)
  234. 'notice_can_activate_recommended' => _n_noop( 'The following recommended plugin is currently inactive: %1$s.', 'The following recommended plugins are currently inactive: %1$s.','buddyapp' ), // %1$s = plugin name(s)
  235. 'notice_cannot_activate' => _n_noop( 'Sorry, but you do not have the correct permissions to activate the %s plugin. Contact the administrator of this site for help on getting the plugin activated.', 'Sorry, but you do not have the correct permissions to activate the %s plugins. Contact the administrator of this site for help on getting the plugins activated.','buddyapp' ), // %1$s = plugin name(s)
  236. 'notice_ask_to_update' => _n_noop( 'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.', 'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.','buddyapp' ), // %1$s = plugin name(s)
  237. 'notice_cannot_update' => _n_noop( 'Sorry, but you do not have the correct permissions to update the %s plugin. Contact the administrator of this site for help on getting the plugin updated.', 'Sorry, but you do not have the correct permissions to update the %s plugins. Contact the administrator of this site for help on getting the plugins updated.','buddyapp' ), // %1$s = plugin name(s)
  238. 'install_link' => _n_noop( 'Begin installing plugin', 'Begin installing plugins', 'buddyapp' ),
  239. 'activate_link' => _n_noop( 'Activate installed plugin', 'Activate installed plugins', 'buddyapp' ),
  240. 'return' => esc_html__( 'Return to Required Plugins Installer', 'buddyapp', 'buddyapp' ),
  241. 'plugin_activated' => esc_html__( 'Plugin activated successfully.', 'buddyapp' ),
  242. 'complete' => esc_html__( 'All plugins installed and activated successfully. %s', 'buddyapp' ) // %1$s = dashboard link
  243. )
  244. );
  245.  
  246. tgmpa( $plugins, $config );
  247.  
  248. }
  249.  
  250.  
  251.  
  252. /**
  253. * Sets up theme defaults and registers the various WordPress features
  254. *
  255. * @uses load_theme_textdomain() For translation/localization support.
  256. * @uses add_editor_style() To add a Visual Editor stylesheet.
  257. * @uses add_theme_support() To add support for post thumbnails, automatic feed links,
  258. * custom background, and post formats.
  259. * @uses register_nav_menu() To add support for navigation menus.
  260. * @uses set_post_thumbnail_size() To set a custom post thumbnail size.
  261. *
  262. * @since Kleo Framework 1.0
  263. */
  264. function kleo_setup() {
  265.  
  266. /*
  267. * Makes theme available for translation.
  268. * Translations can be added to the /languages/ directory.
  269. */
  270. load_theme_textdomain( 'buddyapp', get_template_directory() . '/languages' );
  271.  
  272. /* This theme styles the visual editor with editor-style.css to match the theme style. */
  273. add_editor_style();
  274.  
  275. /* Adds RSS feed links to <head> for posts and comments. */
  276. add_theme_support( 'automatic-feed-links' );
  277.  
  278. /*
  279. * Enable support for Post Formats.
  280. * See http://codex.wordpress.org/Post_Formats
  281. */
  282. add_theme_support( 'post-formats', array(
  283. 'image', 'gallery', 'status', 'quote', 'video'
  284. ) );
  285.  
  286. /* This theme uses wp_nav_menu() in two locations. */
  287. register_nav_menu( 'primary', esc_html__( 'Main Menu (Side)', 'buddyapp' ) );
  288. register_nav_menu( 'top-left', esc_html__( 'Top Left Header Menu', 'buddyapp' ) );
  289. register_nav_menu( 'top-right', esc_html__( 'Top Right Header Menu', 'buddyapp' ) );
  290.  
  291.  
  292. /* This theme uses a custom image size for featured images, displayed on "standard" posts. */
  293. add_theme_support( 'post-thumbnails' );
  294. set_post_thumbnail_size( 672, 9999 ); // Unlimited height, soft crop
  295. /*
  296. * Switch default core markup for search form, comment form, and comments
  297. * to output valid HTML5.
  298. */
  299. add_theme_support( 'html5', array(
  300. 'search-form', 'comment-form', 'comment-list',
  301. ) );
  302.  
  303. /* Specific framework functionality */
  304. add_theme_support( 'kleo-sidebar-generator' );
  305. add_theme_support( 'kleo-menu-custom' );
  306. add_theme_support( 'kleo-menu-items' );
  307.  
  308. /* Third-party plugins */
  309. add_theme_support( 'bbpress' );
  310. add_theme_support( 'woocommerce' );
  311.  
  312. add_theme_support( 'title-tag' );
  313.  
  314. }
  315. add_action( 'after_setup_theme', 'kleo_setup' );
  316.  
  317.  
  318.  
  319. /***************************************************
  320. :: Load Theme files
  321. ***************************************************/
  322.  
  323. add_action( 'after_setup_theme', 'kleo_theme_functions', 12 );
  324.  
  325. function kleo_theme_functions() {
  326.  
  327. // Resize on the fly
  328. require_once( KLEO_LIB_DIR . '/inc/aq_resizer.php' );
  329.  
  330. // Menu structure
  331. require_once( KLEO_LIB_DIR . '/menu.php' );
  332.  
  333. /* Custom menu */
  334. require_if_theme_supports('kleo-menu-custom', KLEO_LIB_DIR . '/menu-custom.php');
  335.  
  336. /* Custom menu items */
  337. require_if_theme_supports('kleo-menu-items', KLEO_LIB_DIR . '/menu-items.php');
  338.  
  339. /* Include admin customizations */
  340. if ( is_customize_preview() ) {
  341. require_once( KLEO_LIB_DIR . '/customizer/setup.php' );
  342. }
  343.  
  344. //Meta Boxes
  345. if ( is_admin() ) {
  346. require_once(KLEO_LIB_DIR . '/metaboxes.php');
  347. }
  348.  
  349. //Dynamic CSS generation
  350. require_once( KLEO_LIB_DIR . '/dynamic-css/dynamic-css.php' );
  351.  
  352. /* BuddyPress compatibility */
  353. if ( function_exists( 'bp_is_active' ) ) {
  354. require_once( KLEO_LIB_DIR . '/plugins/buddypress/buddypress.php' );
  355. }
  356.  
  357. /* bbPress compatibility */
  358. if ( class_exists( 'bbPress' ) ) {
  359. require_once( KLEO_LIB_DIR . '/plugins/bbpress/bbpress.php' );
  360. }
  361.  
  362. /* Woocommerce compatibility */
  363. if ( class_exists( 'WooCommerce' ) ) {
  364. require_once( KLEO_LIB_DIR . '/plugins/woocommerce.php' );
  365. }
  366.  
  367.  
  368. /* WPML compatibility */
  369. if ( function_exists( 'icl_get_languages' ) ) {
  370. require_once( KLEO_LIB_DIR . '/plugins/wpml.php' );
  371. }
  372.  
  373. /* Visual composer compatibility */
  374. if ( function_exists( 'vc_set_as_theme' ) ) {
  375. require_once( KLEO_LIB_DIR . '/plugins/visual-composer.php' );
  376. }
  377.  
  378. /* Cleverness TodoList compatibility */
  379. if ( class_exists('CTDL_Widget')) {
  380. require_once( KLEO_LIB_DIR . '/plugins/ctdl.php' );
  381. }
  382.  
  383. /* Easy Knowledge Base compatibility */
  384. if ( function_exists( 'sq_kb_setup_post_type' ) ) {
  385. require_once( KLEO_LIB_DIR . '/plugins/easy-kb/easy-kb.php' );
  386. }
  387.  
  388. // menu-items-visibility-control plugin compatibility
  389. if ( class_exists( 'Boom_Walker_Nav_Menu_Edit' ) ) {
  390. require_once( KLEO_LIB_DIR . '/plugins/menu-items-visibility-control.php' );
  391. }
  392.  
  393. }
  394.  
  395.  
  396.  
  397. /***************************************************
  398. :: Load Theme specific functions
  399. ***************************************************/
  400.  
  401. require_once( trailingslashit( KLEO_LIB_DIR ) . 'theme-functions.php' );
  402.  
  403.  
  404.  
  405. /***************************************************
  406. :: Load Theme Panel
  407. ***************************************************/
  408.  
  409. if( is_admin() ) {
  410. require_once( trailingslashit(KLEO_LIB_DIR) . 'theme-panel/init.php' );
  411. }
  412.  
  413.  
  414.  
  415. /***************************************************
  416. :: 1 Click Install
  417. ***************************************************/
  418. if ( is_admin() ) {
  419. require_once( trailingslashit(KLEO_LIB_DIR) . '/importer/import.php' );
  420. }
  421.  
  422.  
  423.  
  424. /***************************************************
  425. :: Load components
  426. ***************************************************/
  427.  
  428. $kleo_components = array(
  429. 'base.php',
  430. 'page-title.php',
  431. 'extras.php',
  432. );
  433.  
  434. $kleo_components = apply_filters( 'kleo_components', $kleo_components );
  435.  
  436. foreach ( $kleo_components as $component ) {
  437. $file_path = trailingslashit( KLEO_LIB_DIR ) . 'components/' . $component;
  438. include_once $file_path;
  439. }
  440.  
  441.  
  442.  
  443. /***************************************************
  444. :: Load modules
  445. ***************************************************/
  446.  
  447. $kleo_modules = array(
  448. 'facebook-login.php'
  449. );
  450.  
  451. $kleo_modules = apply_filters( 'kleo_modules', $kleo_modules );
  452.  
  453. foreach ( $kleo_modules as $module ) {
  454. $file_path = trailingslashit( KLEO_LIB_DIR ) . 'modules/' . $module;
  455. include_once $file_path;
  456. }
  457.  
  458.  
  459.  
  460. /***************************************************
  461. :: Include widgets
  462. ***************************************************/
  463.  
  464. $kleo_widgets = array(
  465. 'recent_posts.php',
  466. 'social-share.php'
  467. );
  468.  
  469. $kleo_widgets = apply_filters( 'kleo_widgets', $kleo_widgets );
  470.  
  471. foreach ( $kleo_widgets as $widget ) {
  472. $file_path = trailingslashit( KLEO_LIB_DIR ) . 'widgets/' . $widget;
  473.  
  474. if ( file_exists( $file_path ) ) {
  475. require_once( $file_path );
  476. }
  477. }
  478.  
  479.  
  480. if ( ! function_exists( 'kleo_widgets_init' ) ) {
  481. /**
  482. * Registers our main widget area and the front page widget areas.
  483. *
  484. * @since Kleo 1.0
  485. */
  486. function kleo_widgets_init()
  487. {
  488. register_sidebar(array(
  489. 'name' => esc_html__('Main Sidebar', 'buddyapp'),
  490. 'id' => 'sidebar-1',
  491. 'description' => esc_html__('Main Sidebar', 'buddyapp'),
  492. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  493. 'after_widget' => '</div>',
  494. 'before_title' => '<h4 class="widget-title">',
  495. 'after_title' => '</h4>',
  496. ));
  497.  
  498. register_sidebar(array(
  499. 'name' => esc_html__('Side menu Area', 'buddyapp'),
  500. 'id' => 'side',
  501. 'description' => esc_html__('Side Menu Area', 'buddyapp'),
  502. 'before_widget' => '<div id="%1$s" class="menu-section widget %2$s">',
  503. 'after_widget' => '</div>',
  504. 'before_title' => '<p class="menu-section-header"><span>',
  505. 'after_title' => '</span></p>',
  506. ));
  507.  
  508. register_sidebar(array(
  509. 'name' => 'Footer column 1',
  510. 'id' => 'footer-1',
  511. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  512. 'after_widget' => '</div>',
  513. 'before_title' => '<h4 class="widget-title">',
  514. 'after_title' => '</h4>',
  515. ));
  516.  
  517. register_sidebar(array(
  518. 'name' => 'Footer column 2',
  519. 'id' => 'footer-2',
  520. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  521. 'after_widget' => '</div>',
  522. 'before_title' => '<h4 class="widget-title">',
  523. 'after_title' => '</h4>',
  524. ));
  525.  
  526. register_sidebar(array(
  527. 'name' => 'Footer column 3',
  528. 'id' => 'footer-3',
  529. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  530. 'after_widget' => '</div>',
  531. 'before_title' => '<h4 class="widget-title">',
  532. 'after_title' => '</h4>',
  533. ));
  534.  
  535. register_sidebar(array(
  536. 'name' => 'Footer column 4',
  537. 'id' => 'footer-4',
  538. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  539. 'after_widget' => '</div>',
  540. 'before_title' => '<h4 class="widget-title">',
  541. 'after_title' => '</h4>',
  542. ));
  543.  
  544. }
  545. }
  546. add_action( 'widgets_init', 'kleo_widgets_init' );
  547.  
  548.  
  549.  
  550. /***************************************************
  551. :: Scripts/Styles load
  552. ***************************************************/
  553.  
  554. add_action( 'wp_enqueue_scripts', 'kleo_frontend_files' );
  555. if ( ! function_exists( 'kleo_frontend_files' ) ) :
  556. // Register some javascript files
  557. function kleo_frontend_files()
  558. {
  559.  
  560. $min = '';
  561. if ( sq_option( 'dev_mode', false ) == false ) {
  562. $min = '.min';
  563. }
  564. //head scripts
  565. wp_register_script( 'modernizr', get_template_directory_uri() . '/assets/js/modernizr.custom.92164.js', array(),KLEO_THEME_VERSION, false );
  566.  
  567. /* Footer scripts */
  568. wp_register_script( 'kleo-plugins', get_template_directory_uri() . '/assets/js/plugins.js', array('jquery'),KLEO_THEME_VERSION, true );
  569. wp_register_script( 'kleo-app', get_template_directory_uri() . '/assets/js/functions' . $min . '.js', array('jquery', 'kleo-plugins' ),KLEO_THEME_VERSION, true );
  570.  
  571. //enqueue them
  572. wp_enqueue_script('modernizr');
  573. wp_enqueue_script('kleo-plugins');
  574.  
  575. wp_enqueue_script('kleo-app');
  576.  
  577. $obj_array = array(
  578. 'ajaxurl' => admin_url('admin-ajax.php'),
  579. 'loadingMessage' => '<i class="icon-refresh animate-spin"></i> ' . esc_html__( 'Sending info, please wait...', 'buddyapp' ),
  580. 'errorMessage' => esc_html__('Sorry, an error occurred. Try again later.', 'buddyapp')
  581. );
  582. $obj_array = apply_filters( 'kleo_localize_app', $obj_array );
  583.  
  584. wp_localize_script( 'kleo-app', 'KLEO', $obj_array );
  585.  
  586. if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
  587. wp_enqueue_script( 'comment-reply' );
  588. }
  589.  
  590. // Register the styles
  591. wp_register_style( 'bootstrap', get_template_directory_uri() . '/assets/css/bootstrap.min.css', array(), KLEO_THEME_VERSION, 'all' );
  592. wp_register_style( 'buddyapp', get_template_directory_uri() . '/assets/less/theme' . $min . '.css', array(), KLEO_THEME_VERSION, 'all' );
  593. wp_register_style( 'kleo-font-icons', sq_get_fonts_path() , array(), KLEO_THEME_VERSION, 'all' );
  594. wp_register_style( 'kleo-animate', get_template_directory_uri() . '/assets/css/animate.css', array(), KLEO_THEME_VERSION, 'all' );
  595. wp_register_style( 'magnific-popup', get_template_directory_uri() . '/assets/css/magnific-popup.css', array(), KLEO_THEME_VERSION, 'all' );
  596. wp_register_style( 'outdatedbrowser', get_template_directory_uri() . '/assets/js/3rd-plugins/outdatedbrowser/outdatedbrowser.min.css', array(), KLEO_THEME_VERSION, 'all' );
  597.  
  598. wp_register_style( 'kleo-style', CHILD_THEME_URI . '/style.css', array(), KLEO_THEME_VERSION, 'all' );
  599.  
  600. //enqueue required styles
  601. wp_enqueue_style( 'bootstrap' );
  602. wp_enqueue_style( 'buddyapp' );
  603. wp_enqueue_style( 'kleo-font-icons' );
  604. wp_enqueue_style( 'kleo-animate' );
  605. wp_enqueue_style( 'magnific-popup' );
  606. wp_enqueue_style( 'outdatedbrowser' );
  607.  
  608. } // end kleo_frontend_files()
  609. endif;
  610.  
  611.  
  612. function sq_get_fonts_path() {
  613. $fonts_path = get_template_directory_uri() . '/assets/fonts/style.css';
  614. if ( is_child_theme() && file_exists( CHILD_THEME_DIR . '/assets/fonts/style.css' )) {
  615. $fonts_path = get_stylesheet_directory_uri() . '/assets/fonts/style.css';
  616. }
  617.  
  618. return $fonts_path;
  619. }
  620.  
  621.  
  622. add_action( 'wp_enqueue_scripts', 'kleo_load_files_plugin_compat', 1000 );
  623.  
  624. function kleo_load_files_plugin_compat()
  625. {
  626. //enqueue child theme style only if activated
  627. if (is_child_theme()) {
  628. wp_enqueue_style( 'kleo-style' );
  629. }
  630.  
  631.  
  632. } // kleo_load_css_files_plugin_compat()
  633.  
  634.  
  635.  
  636. /***************************************************
  637. :: ADMIN CSS
  638. ***************************************************/
  639. function kleo_admin_styles() {
  640. wp_register_style( "kleo-admin", KLEO_LIB_URI . "/assets/admin-custom.css", false, "1.0", "all" );
  641. wp_enqueue_style( 'kleo-admin' );
  642. }
  643. add_action( 'admin_enqueue_scripts', 'kleo_admin_styles' );
  644.  
  645.  
  646.  
  647. /***************************************************
  648. :: Customize wp-login.php
  649. ***************************************************/
  650. function custom_login_css() {
  651. echo "\n<style>";
  652.  
  653. echo '.login h1 a { background-image: url("'.sq_option('logo','none').'");background-size: contain;min-height: 88px;width:auto;}';
  654. echo '#login {padding: 20px 0 0;}';
  655. echo '.login #nav a, .login #backtoblog a {color:'.sq_option('header_primary_color').'!important;text-shadow:none;}';
  656.  
  657. echo "</style>\n";
  658. }
  659. add_action( 'login_enqueue_scripts', 'custom_login_css' );
  660.  
  661. function kleo_new_wp_login_url() { return home_url(); }
  662. add_filter('login_headerurl', 'kleo_new_wp_login_url');
  663.  
  664. function kleo_new_wp_login_title() { return get_option('blogname'); }
  665. add_filter('login_headertitle', 'kleo_new_wp_login_title');
  666.  
  667.  
  668.  
  669.  
  670.  
  671. if ( ! function_exists( '_wp_render_title_tag' ) ) {
  672. function kleo_slug_render_title() {
  673. ?>
  674. <title><?php wp_title( '|', true, 'right' ); ?></title>
  675. <?php
  676. }
  677. add_action( 'wp_head', 'kleo_slug_render_title' );
  678. }
  679.  
  680.  
  681.  
  682. if (!function_exists('kleo_wp_title')):
  683. /**
  684. * Creates a nicely formatted and more specific title element text
  685. * for output in head of document, based on current view.
  686. *
  687. * @since Kleo Framework 1.0
  688. *
  689. * @param string $title Default title text for current view.
  690. * @param string $sep Optional separator.
  691. * @return string Filtered title.
  692. */
  693. function kleo_wp_title( $title, $sep )
  694. {
  695. global $paged, $page;
  696.  
  697. if ( is_feed() ) {
  698. return $title;
  699. }
  700. // Add the site name.
  701. $title .= get_bloginfo( 'name' );
  702.  
  703. // Add the site description for the home/front page.
  704. $site_description = get_bloginfo( 'description', 'display' );
  705. if ( $site_description && ( is_home() || is_front_page() ) ) {
  706. $title = "$title $sep $site_description";
  707. }
  708. // Add a page number if necessary.
  709. if ( $paged >= 2 || $page >= 2 ) {
  710. $title = "$title $sep " . sprintf( esc_html__( 'Page %s', 'buddyapp' ), max( $paged, $page ) );
  711. }
  712.  
  713. return $title;
  714. }
  715. if ( ! function_exists( '_wp_render_title_tag' ) ) {
  716. add_filter('wp_title', 'kleo_wp_title', 10, 2);
  717. }
  718. endif;
  719.  
  720.  
  721.  
  722.  
  723. if ( ! function_exists( 'kleo_the_attached_image' ) ) :
  724. /**
  725. * Print the attached image with a link to the next attached image.
  726. *
  727. * @since Kleo 1.0
  728. *
  729. * @return void
  730. */
  731. function kleo_the_attached_image() {
  732. $post = get_post();
  733. /**
  734. * Filter the default attachment size.
  735. *
  736. * @since Kleo 1.0
  737. *
  738. * @param array $dimensions {
  739. * An array of height and width dimensions.
  740. *
  741. * @type int $height Height of the image in pixels. Default 810.
  742. * @type int $width Width of the image in pixels. Default 810.
  743. * }
  744. */
  745. $attachment_size = apply_filters( 'kleo_attachment_size', array( 810, 810 ) );
  746. $next_attachment_url = wp_get_attachment_url();
  747.  
  748. /*
  749. * Grab the IDs of all the image attachments in a gallery so we can get the URL
  750. * of the next adjacent image in a gallery, or the first image (if we're
  751. * looking at the last image in a gallery), or, in a gallery of one, just the
  752. * link to that image file.
  753. */
  754. $attachment_ids = get_posts( array(
  755. 'post_parent' => $post->post_parent,
  756. 'fields' => 'ids',
  757. 'numberposts' => -1,
  758. 'post_status' => 'inherit',
  759. 'post_type' => 'attachment',
  760. 'post_mime_type' => 'image',
  761. 'order' => 'ASC',
  762. 'orderby' => 'menu_order ID',
  763. ) );
  764.  
  765. // If there is more than 1 attachment in a gallery...
  766. if ( count( $attachment_ids ) > 1 ) {
  767. foreach ( $attachment_ids as $attachment_id ) {
  768. if ( $attachment_id == $post->ID ) {
  769. $next_id = current( $attachment_ids );
  770. break;
  771. }
  772. }
  773.  
  774. // get the URL of the next image attachment...
  775. if ( $next_id ) {
  776. $next_attachment_url = get_attachment_link( $next_id );
  777. }
  778.  
  779. // or get the URL of the first image attachment.
  780. else {
  781. $next_attachment_url = get_attachment_link( array_shift( $attachment_ids ) );
  782. }
  783. }
  784.  
  785. printf( '<a href="%1$s" rel="attachment">%2$s</a>',
  786. esc_url( $next_attachment_url ),
  787. wp_get_attachment_image( $post->ID, $attachment_size )
  788. );
  789. }
  790. endif;
  791.  
  792.  
  793.  
  794. /***************************************************
  795. :: Modal Ajax login && Modal Lost Password
  796. ***************************************************/
  797.  
  798.  
  799. add_filter( 'kleo_theme_settings', 'kleo_login_settings' );
  800.  
  801. function kleo_login_settings( $kleo )
  802. {
  803. //
  804. // Settings Sections
  805. //
  806.  
  807. $kleo['sec']['kleo_section_login'] = array(
  808. 'title' => esc_html__( 'Login redirect', 'buddyapp' ),
  809. 'priority' => 16
  810. );
  811.  
  812. $kleo['set'][] = array(
  813. 'id' => 'login_redirect',
  814. 'title' => esc_html__('Login page redirect', 'buddyapp'),
  815. 'type' => 'select',
  816. 'default' => 'default',
  817. 'choices' => array( 'default' => 'Default', 'reload' => 'Reload', 'custom' => 'Custom link'),
  818. 'section' => 'kleo_section_login',
  819. 'description' => esc_html__('Default: WordPress default behaviour. Reload: will reload current page.', 'buddyapp'),
  820. );
  821.  
  822. $kleo['set'][] = array(
  823. 'id' => 'login_redirect_custom',
  824. 'title' => esc_html__( 'Custom link redirect', 'buddyapp' ),
  825. 'type' => 'text',
  826. 'default' => '',
  827. 'section' => 'kleo_section_login',
  828. 'description' => wp_kses( __('Set a link like http://yoursite.com/homepage for users to get redirected on login.<br> ' .
  829. 'For more complex redirect logic please set Login redirect to Default WordPress and use Peter\'s redirect plugin or similar.', 'buddyapp'), array( 'br' => array() ) ),
  830. 'condition' => array( 'login_redirect', 'custom' )
  831. );
  832.  
  833.  
  834. return $kleo;
  835.  
  836. }
  837.  
  838. add_action( 'wp_footer', 'kleo_load_popups', 12 );
  839.  
  840. function kleo_load_popups() {
  841. get_template_part( 'page-parts/general-popups' );
  842. }
  843.  
  844. add_action( 'init', 'kleo_ajax_login' );
  845.  
  846. if (! function_exists('kleo_ajax_login')){
  847. function kleo_ajax_login()
  848. {
  849.  
  850. /* If not our action, bail out */
  851. if (! isset($_POST['action']) || ( isset($_POST['action']) && $_POST['action'] != 'kleoajaxlogin' ) ) {
  852. return false;
  853. }
  854.  
  855. /* If user is already logged in print a specific message */
  856. if ( is_user_logged_in() ) {
  857. $link = "javascript:window.location.reload();return false;";
  858. echo json_encode(
  859. array(
  860. 'loggedin' => false,
  861. 'message' => '<i class="icon-info-outline"></i> ' .
  862. wp_kses(
  863. sprintf( __( 'You are already logged in. Please <a href="#" onclick="%s">refresh</a> page', 'buddyapp' ), $link ),
  864. array( 'a' => array( 'href' => true, 'onclick' => true ) )
  865. )
  866. )
  867. );
  868. die();
  869. }
  870.  
  871. // Check the nonce, if it fails the function will break
  872. check_ajax_referer( 'kleo-ajax-login-nonce', 'security-login' );
  873.  
  874. // Nonce is checked, continue
  875. $secure_cookie = '';
  876.  
  877. // If the user wants ssl but the session is not ssl, force a secure cookie.
  878. if ( !empty($_POST['log']) && !force_ssl_admin() ) {
  879. $user_name = sanitize_user($_POST['log']);
  880. if ( $user = get_user_by('login', $user_name) ) {
  881. if ( get_user_option('use_ssl', $user->ID) ) {
  882. $secure_cookie = true;
  883. force_ssl_admin(true);
  884. }
  885. }
  886. }
  887.  
  888. if ( isset( $_REQUEST['redirect_to'] ) ) {
  889. $redirect_to = $_REQUEST['redirect_to'];
  890. // Redirect to https if user wants ssl
  891. if ( $secure_cookie && false !== strpos($redirect_to, 'wp-admin') )
  892. $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
  893. } else {
  894. $redirect_to = '';
  895. }
  896.  
  897. $user_signon = wp_signon( '', $secure_cookie );
  898. if ( is_wp_error( $user_signon ) ) {
  899. $error_msg = $user_signon->get_error_message();
  900. echo json_encode(array( 'loggedin' => false, 'message' => '<span class="wrong-response"><i class="icon-warning"></i> ' . wp_kses_data( $error_msg ) . '</span>' ));
  901. //echo json_encode(array( 'loggedin' => false, 'message' => '<span class="wrong-response"><i class="icon-warning"></i> ' . esc_html__( 'Wrong username or password. Please try again.', 'buddyapp' ) . '</span>' ));
  902. } else {
  903. if ( sq_option( 'login_redirect' , 'default' ) == 'reload' ) {
  904. $redirecturl = NULL;
  905. } else {
  906. $requested_redirect_to = isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
  907. /**
  908. * Filter the login redirect URL.
  909. *
  910. * @since 3.0.0
  911. *
  912. * @param string $redirect_to The redirect destination URL.
  913. * @param string $requested_redirect_to The requested redirect destination URL passed as a parameter.
  914. * @param WP_User|WP_Error $user WP_User object if login was successful, WP_Error object otherwise.
  915. */
  916. $redirecturl = apply_filters( 'login_redirect', $redirect_to, $requested_redirect_to, $user_signon );
  917.  
  918. }
  919.  
  920. echo json_encode(
  921. array(
  922. 'loggedin' => true,
  923. 'redirecturl' => $redirecturl,
  924. 'message'=> '<span class="good-response"><i class="icon-check"></i> ' .
  925. esc_html__( 'Login successful, redirecting...', 'buddyapp' ) . '</span>'
  926. )
  927. );
  928. }
  929.  
  930. die();
  931. }
  932. }
  933.  
  934.  
  935. if ( ! function_exists( 'kleo_lost_password_ajax' )) {
  936. function kleo_lost_password_ajax()
  937. {
  938. $errors = new WP_Error();
  939.  
  940. if ( isset($_POST) ) {
  941.  
  942. // Check the nonce, if it fails the function will break
  943. check_ajax_referer( 'kleo-ajax-lost-pass-nonce', 'security_lost_pass' );
  944.  
  945. if ( empty( $_POST['user_login'] ) ) {
  946. $errors->add(
  947. 'empty_username',
  948. wp_kses_data( __( '<strong>ERROR</strong>: Enter a username or e-mail address.', 'default' ) )
  949. );
  950. } else if ( strpos( $_POST['user_login'], '@' ) ) {
  951. $user_data = get_user_by( 'email', trim( wp_unslash( $_POST['user_login'] ) ) );
  952. if ( empty( $user_data ) )
  953. $errors->add(
  954. 'invalid_email',
  955. wp_kses_data( __( '<strong>ERROR</strong>: There is no user registered with that email address.', 'default' ) )
  956. );
  957. } else {
  958. $login = trim($_POST['user_login']);
  959. $user_data = get_user_by('login', $login);
  960. }
  961.  
  962. /**
  963. * Fires before errors are returned from a password reset request.
  964. *
  965. * @since 2.1.0
  966. * @since 4.4.0 Added the `$errors` parameter.
  967. *
  968. * @param WP_Error $errors A WP_Error object containing any errors generated
  969. * by using invalid credentials.
  970. */
  971. do_action( 'lostpassword_post', $errors );
  972.  
  973. if ( $errors->get_error_code() ) {
  974. echo '<span class="wrong-response">' . $errors->get_error_message() . '</span>';
  975. die();
  976. }
  977.  
  978. if ( ! $user_data ) {
  979. $errors->add(
  980. 'invalidcombo', wp_kses_data( __( '<strong>ERROR</strong>: Invalid username or e-mail.', 'default' ) )
  981. );
  982. echo '<span class="wrong-response">' . $errors->get_error_message() . '</span>';
  983. die();
  984. }
  985.  
  986. // Redefining user_login ensures we return the right case in the email.
  987. $user_login = $user_data->user_login;
  988. $user_email = $user_data->user_email;
  989. $key = get_password_reset_key( $user_data );
  990.  
  991. if ( is_wp_error( $key ) ) {
  992. echo '<span class="wrong-response">' . $key->get_error_message() . '</span>';
  993. die();
  994. }
  995.  
  996. $message = esc_html__( 'Someone requested that the password be reset for the following account:', 'default' ) . "\r\n\r\n";
  997. $message .= network_home_url( '/' ) . "\r\n\r\n";
  998. $message .= sprintf( esc_html__( 'Username: %s', 'default' ), $user_login ) . "\r\n\r\n";
  999. $message .= esc_html__('If this was a mistake, just ignore this email and nothing will happen.', 'default' ) . "\r\n\r\n";
  1000. $message .= esc_html__('To reset your password, visit the following address:', 'default') . "\r\n\r\n";
  1001. $message .= '<' . network_site_url( "wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login' ) . ">\r\n";
  1002.  
  1003. if ( is_multisite() )
  1004. $blogname = get_network()->site_name;
  1005. else
  1006. /*
  1007. * The blogname option is escaped with esc_html on the way into the database
  1008. * in sanitize_option we want to reverse this for the plain text arena of emails.
  1009. */
  1010. $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
  1011.  
  1012. $title = sprintf( esc_html__('[%s] Password Reset', 'default'), $blogname );
  1013.  
  1014. /**
  1015. * Filters the subject of the password reset email.
  1016. *
  1017. * @since 2.8.0
  1018. * @since 4.4.0 Added the `$user_login` and `$user_data` parameters.
  1019. *
  1020. * @param string $title Default email title.
  1021. * @param string $user_login The username for the user.
  1022. * @param WP_User $user_data WP_User object.
  1023. */
  1024. $title = apply_filters( 'retrieve_password_title', $title, $user_login, $user_data );
  1025.  
  1026. /**
  1027. * Filters the message body of the password reset mail.
  1028. *
  1029. * @since 2.8.0
  1030. * @since 4.1.0 Added `$user_login` and `$user_data` parameters.
  1031. *
  1032. * @param string $message Default mail message.
  1033. * @param string $key The activation key.
  1034. * @param string $user_login The username for the user.
  1035. * @param WP_User $user_data WP_User object.
  1036. */
  1037. $message = apply_filters( 'retrieve_password_message', $message, $key, $user_login, $user_data );
  1038.  
  1039.  
  1040. if ( $message && ! wp_mail( $user_email, wp_specialchars_decode( $title ), $message ) ) {
  1041. echo '<span class="wrong-response">' . esc_html__( "Failure!", 'buddyapp' );
  1042. echo esc_html__( 'The e-mail could not be sent.', 'default' );
  1043. echo "</span>";
  1044. die();
  1045. } else {
  1046. echo '<span class="good-response">' . esc_html__( "Email successfully sent!", 'buddyapp' )."</span>";
  1047. die();
  1048. }
  1049. }
  1050. die();
  1051. }
  1052. }
  1053. add_action("wp_ajax_kleo_lost_password","kleo_lost_password_ajax");
  1054. add_action('wp_ajax_nopriv_kleo_lost_password', 'kleo_lost_password_ajax');
  1055.  
  1056.  
  1057.  
  1058. /***************************************************
  1059. :: Custom redirect from Theme options - Login redirect
  1060. ***************************************************/
  1061.  
  1062. if ( sq_option( 'login_redirect', 'default' ) == 'custom' && sq_option( 'login_redirect_custom', '' ) != '' ) {
  1063. add_filter( 'login_redirect', 'kleo_custom_redirect', 12, 3 );
  1064. }
  1065.  
  1066. /**
  1067. * Redirect user after successful login.
  1068. *
  1069. * @param string $redirect_to URL to redirect to.
  1070. * @param string $requested_redirect_to URL for redirect
  1071. * @param object $user Logged user's data.
  1072. * @return string
  1073. */
  1074. function kleo_custom_redirect( $redirect_to, $requested_redirect_to, $user ) {
  1075. if ( ($requested_redirect_to == ''|| $requested_redirect_to != home_url() ) && ! is_wp_error( $user ) ) {
  1076. $redirect_to = sq_option( 'login_redirect_custom', '' );
  1077. $redirect_to = str_replace( '##member_name##', $user->user_login, $redirect_to );
  1078. }
  1079. return $redirect_to;
  1080. }
  1081.  
  1082. // -----------------------------------------------------------------------------
  1083.  
  1084.  
  1085. /***************************************************
  1086. :: Render the footer columns
  1087. ***************************************************/
  1088.  
  1089. function add_footer_widgets_columns() {
  1090.  
  1091. if ( ! is_active_sidebar( 'footer-1' ) && ! is_active_sidebar( 'footer-2' ) && ! is_active_sidebar( 'footer-3' ) && ! is_active_sidebar( 'footer-4' ) ) {
  1092. return;
  1093. }
  1094.  
  1095. ?>
  1096. <div id="footer" class="footer-color border-top">
  1097. <div class="container-full">
  1098. <div class="template-page tpl-no">
  1099. <div class="wrap-content">
  1100. <div class="row">
  1101. <div class="col-sm-3">
  1102. <div id="footer-sidebar-1" class="footer-sidebar widget-area" role="complementary">
  1103. <?php
  1104. if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('footer-1')):
  1105. endif;
  1106. ?>
  1107. </div>
  1108. </div>
  1109. <div class="col-sm-3">
  1110. <div id="footer-sidebar-2" class="footer-sidebar widget-area" role="complementary">
  1111. <?php
  1112. if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('footer-2')):
  1113. endif;
  1114. ?>
  1115. </div>
  1116. </div>
  1117. <div class="col-sm-3">
  1118. <div id="footer-sidebar-3" class="footer-sidebar widget-area" role="complementary">
  1119. <?php
  1120. if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('footer-3')):
  1121. endif;
  1122. ?>
  1123. </div>
  1124. </div>
  1125. <div class="col-sm-3">
  1126. <div id="footer-sidebar-4" class="footer-sidebar widget-area" role="complementary">
  1127. <?php
  1128. if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('footer-4')):
  1129. endif;
  1130. ?>
  1131. </div>
  1132. </div>
  1133. </div>
  1134. </div>
  1135. </div>
  1136. </div>
  1137. </div><!-- #footer -->
  1138.  
  1139. <?php
  1140. }
  1141.  
  1142. add_action( 'kleo_after_content', 'add_footer_widgets_columns', 20 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement