Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function ac_theme_enqueue_styles()
- {
- $parent_style = 'parent-style-nellie';
- wp_enqueue_style($parent_style, get_stylesheet_directory_uri() . '/assets/css/divi.css');
- wp_enqueue_style('child-style', get_stylesheet_directory_uri() . '/style.css', array(
- $parent_style
- ));
- }
- add_action('wp_enqueue_scripts', 'ac_theme_enqueue_styles');
- function ac_n_dq_parent_style()
- {
- wp_dequeue_style('divi-style');
- wp_register_style('parent-style-nellie', get_stylesheet_directory_uri() . '/assets/css/divi.css', false, '1.0.0');
- wp_enqueue_style('parent-style-nellie');
- }
- function ac_n_parent_script_enq()
- {
- add_action('wp_enqueue_scripts', 'ac_n_dq_parent_style');
- }
- add_action('after_setup_theme', 'ac_n_parent_script_enq');
- add_action('after_setup_theme', 'ac_n_load_text_domain');
- function ac_n_load_text_domain()
- {
- load_child_theme_textdomain('Nellie', get_stylesheet_directory() . '/languages');
- }
- require 'inc/update.php';
- $ac_auto_updater = new acautoupdater('Nellie', 'https://ayanize.com/api/?action=get_metadata&slug=Nellie');
- require_once get_stylesheet_directory() . '/inc/pl-installer.php';
- require get_stylesheet_directory() . '/includes/login/settings.php';
- require get_stylesheet_directory() . '/inc/ac-importer.php';
- require get_stylesheet_directory() . '/includes/footer/footer.php';
- require get_stylesheet_directory() . '/includes/404/404page.php';
- require get_stylesheet_directory() . '/includes/branding/functions.php';
- require get_stylesheet_directory() . '/includes/maps/functions.php';
- require get_stylesheet_directory() . '/woocommerce/functions.php';
- require get_stylesheet_directory() . '/inc/theme.php';
- require get_stylesheet_directory() . '/includes/sc/functions.php';
- require get_stylesheet_directory() . '/includes/branding/code/settings.php';
- require get_stylesheet_directory() . '/includes/general/functions.php';
- require get_stylesheet_directory() . '/includes/mobile/functions.php';
- add_action('init', 'remove_wc_column_num');
- add_action('admin_enqueue_scripts', 'ac_admin_import_scripts');
- add_action('wp_enqueue_scripts', 'ac_front_js');
- add_action('admin_enqueue_scripts', 'ac_load_admin_scripts');
- add_action('admin_enqueue_scripts', 'ac_load_alt_admin_css');
- add_action('ac_plugins_settings', 'ac_install_req_plugins_');
- add_action('admin_menu', 'ac_add_menu');
- add_action('admin_menu', 'ac_n_add_sub_menu');
- add_action('admin_init', 'ac_theme_options');
- add_action('admin_init', 'ac_register_theme_options_settings');
- add_action('admin_head', 'ac_force_plugin_activation');
- add_action('admin_init', 'ac_nag_ignore');
- if (get_option('ac_misc_remove_header_format') == 0) {
- add_action('admin_init', 'ac_header_centered_default');
- }
- function ac_n_wc_support()
- {
- add_theme_support('wc-product-gallery-zoom');
- add_theme_support('wc-product-gallery-lightbox');
- add_theme_support('wc-product-gallery-slider');
- }
- add_action('after_setup_theme', 'ac_n_wc_support', 20);
- add_shortcode('wc-sidebar', 'ac_wc_sidebar');
- add_action('wp_print_styles', 'ac_call_custom_gf');
- remove_filter('pre_user_description', 'wp_filter_kses');
- add_action('ac_small_logo', 'ac_switch_small_logo_header');
- add_filter('user_contactmethods', 'ac_modify_contact_methods');
- if (get_option('ac_misc_back_header_menu_tabs') == 0) {
- add_action('admin_head', 'show_ac_wc_tab');
- }
- add_action('ac_login_register', 'ac_rename_login_register');
- add_action('login_head', 'ac_login_placeholder', 999);
- add_action('wp_enqueue_scripts', 'switch_logo');
- add_action('admin_init', 'ac_misc_settings_register');
- add_action('wp_login_failed', 'ac_front_login_fail');
- add_action('wp_head', 'ac_custom_css_bg', 20);
- if (get_option('ac_misc_remove_header_bg') == 1) {
- remove_action('wp_head', 'ac_custom_css_bg', 20);
- }
- add_action('wp_head', 'ac_custom_css', 20);
- add_action('ac_header_elmns', 'ac_header_contacts');
- add_filter('wp_nav_menu_items', 'do_shortcode');
- add_shortcode('ac', 'ac_wc_mega_menu');
- add_action('admin_bar_menu', 'ac_add_options_toolbar', 9999);
- add_action('wp_head', 'ac_noindex_404_template_page', 1);
- add_action('ac_post_type_meta', 'display_post_type_meta', 99);
- add_action('ac_post_type_cat', 'ac_display_cpt_cat_name');
- add_filter('wp_prepare_themes_for_js', 'ac_branding_themes');
- function ac_n_get_divi_ver()
- {
- $theme = wp_get_theme('Divi');
- $ver = $theme->get('Version');
- $compare = version_compare($ver, '3.0.0', '>');
- return $compare;
- }
- function ac_n_get_curr_nellie()
- {
- $theme = wp_get_theme('Nellie');
- $ver = $theme->get('Version');
- $compare = version_compare($ver, '1.4', '=');
- return $compare;
- }
- function remove_wc_column_num()
- {
- remove_filter('loop_shop_columns', 'et_modify_shop_page_columns_num');
- }
- function ac_admin_import_scripts()
- {
- wp_register_script('dummy-import', get_stylesheet_directory_uri() . '/inc/ac-import.js', false, '1.0.0');
- wp_enqueue_script('dummy-import');
- }
- function ac_front_js()
- {
- wp_register_script('ac-front-js', get_stylesheet_directory_uri() . '/js/front.js', array(
- 'jquery'
- ), '1.1', false);
- wp_enqueue_script('ac-front-js');
- wp_register_script('ac-front-stick', get_stylesheet_directory_uri() . '/js/stick.js', array(
- 'jquery'
- ), '1.1', false);
- wp_enqueue_script('ac-front-stick');
- }
- function ac_load_admin_scripts()
- {
- global $pagenow;
- $page = (isset($_REQUEST['page']) ? $_REQUEST['page'] : false);
- if ($pagenow == 'admin.php' && $page == 'ac_nellie_options') {
- wp_register_style('ncp-css', get_stylesheet_directory_uri() . '/assets/css/panel.css', false, '1.0.0');
- wp_enqueue_style('ncp-css');
- }
- }
- function ac_load_alt_admin_css()
- {
- global $pagenow;
- $page = (isset($_REQUEST['page']) ? $_REQUEST['page'] : false);
- if ($pagenow == 'admin.php' && $page == 'ac_nellie_options') {
- return;
- }
- wp_register_style('n-admin-css', get_stylesheet_directory_uri() . '/assets/css/admin.css', false, '1.0.0');
- wp_enqueue_style('n-admin-css');
- }
- function ac_install_req_plugins_()
- {
- $plugins = array(
- array(
- 'name' => 'WooCommerce',
- 'slug' => 'woocommerce',
- 'required' => true,
- 'force_activation' => true,
- 'force_deactivation' => false
- )
- );
- tgmpa($plugins);
- $config = array(
- 'id' => 'ac_nellie',
- 'default_path' => '',
- 'menu' => 'tgmpa-install-plugins',
- 'parent_slug' => 'themes.php',
- 'capability' => 'edit_theme_options',
- 'has_notices' => true,
- 'dismissable' => true,
- 'dismiss_msg' => '',
- 'is_automatic' => true,
- 'message' => ''
- );
- tgmpa($plugins, $config);
- }
- function ac_n_submenus()
- {
- if ('publish' == get_post_status('987451248')) {
- return true;
- } else {
- return false;
- }
- }
- function ac_add_menu()
- {
- if (ac_n_submenus()) {
- add_menu_page(__('Nellie'), __('Nellie'), 'manage_options', 'ac_nellie_options&tab=gen_options', 'theme_options_functions');
- } else {
- add_menu_page(__('Nellie'), __('Nellie'), 'manage_options', 'ac_nellie_options', 'theme_options_functions');
- }
- }
- function ac_n_add_sub_menu()
- {
- if (ac_n_submenus()) {
- add_submenu_page('ac_nellie_options', __('General', 'Nellie'), __('General', 'Nellie'), 'manage_options', 'ac_nellie_options', 'theme_options_functions');
- } else {
- add_submenu_page('ac_nellie_options&tab=gen_options', __('General', 'Nellie'), __('General', 'Nellie'), 'manage_options', 'ac_nellie_options', 'theme_options_functions');
- }
- }
- function ac_n_add_opt_sub_menus()
- {
- $gen_opt = 'ac_nellie_options&tab=gen_options';
- $n_opt = 'ac_nellie_options';
- if (ac_n_submenus()) {
- $sub_opt = $gen_opt;
- } else {
- $sub_opt = $n_opt;
- }
- if (get_option('ac_n_opt_wc_yes') == 1) {
- add_submenu_page($sub_opt, __('WooCommerce', 'Nellie'), __('WooCommerce', 'Nellie'), 'manage_options', 'admin.php?page=ac_nellie_options&tab=wc_options', NULL);
- }
- if (get_option('ac_n_opt_fb_yes') == 1) {
- add_submenu_page($sub_opt, __('Footer Builder', 'Nellie'), __('Footer Builder', 'Nellie'), 'manage_options', 'admin.php?page=ac_nellie_options&tab=footer_builder_options', NULL);
- }
- if (get_option('ac_n_opt_lp_yes') == 1) {
- add_submenu_page($sub_opt, __('Login Customizer', 'Nellie'), __('Login Customizer', 'Nellie'), 'manage_options', 'admin.php?page=ac_nellie_options&tab=login_options', NULL);
- }
- if (get_option('ac_n_opt_brnd_yes') == 1) {
- add_submenu_page($sub_opt, __('Branding', 'Nellie'), __('Branding', 'Nellie'), 'manage_options', 'admin.php?page=ac_nellie_options&tab=branding_options', NULL);
- }
- if (get_option('ac_n_opt_gm_yes') == 1) {
- add_submenu_page($sub_opt, __('Google Map', 'Nellie'), __('Google Map', 'Nellie'), 'manage_options', 'admin.php?page=ac_nellie_options&tab=maps_options', NULL);
- }
- if (get_option('ac_n_opt_misc_yes') == 1) {
- add_submenu_page($sub_opt, __('Miscellaneous', 'Nellie'), __('Miscellaneous', 'Nellie'), 'manage_options', 'admin.php?page=ac_nellie_options&tab=misc_options', NULL);
- }
- if (get_option('ac_n_opt_sc_yes') == 1) {
- add_submenu_page($sub_opt, __('AC ShortCodes', 'Nellie'), __('AC ShortCodes', 'Nellie'), 'manage_options', 'admin.php?page=ac_nellie_options&tab=sc_options', NULL);
- }
- if (get_option('ac_n_opt_cust_yes') == 1) {
- add_submenu_page($sub_opt, __('Customization', 'Nellie'), __('Customization', 'Nellie'), 'manage_options', 'admin.php?page=ac_nellie_options&tab=code_page_options', NULL);
- }
- }
- add_action('admin_menu', 'ac_n_add_opt_sub_menus', 100);
- function ac_theme_options()
- {
- add_settings_section('gen_page', '', 'gen_page_callback', 'gen_page_option');
- add_settings_section('front_page', '', 'front_page_callback', 'front_page_option');
- add_settings_section('second_page', '', 'second_page_callback', 'second_page_option');
- add_settings_section('footer_page', '', 'footer_page_callback', 'footer_page_option');
- add_settings_section('login_page', '', 'login_page_callback', 'login_page_option');
- add_settings_section('branding_page', '', 'branding_page_callback', 'branding_page_option');
- add_settings_section('maps_page', '', 'maps_page_callback', 'maps_page_option');
- add_settings_section('wc_page', '', 'wc_page_callback', 'wc_page_option');
- add_settings_section('misc_page', '', 'misc_page_callback', 'misc_page_option');
- add_settings_section('sc_page', '', 'sc_page_callback', 'sc_page_option');
- add_settings_section('code_page', '', 'code_page_callback', 'code_page_option');
- }
- function ac_register_theme_options_settings()
- {
- register_setting('gen_page_option', 'gen_page_option');
- register_setting('front_page_option', 'front_page_option');
- register_setting('second_page_option', 'second_page_option');
- register_setting('footer_page_option', 'footer_page_option');
- register_setting('code_page_option', 'code_page_option');
- register_setting('login_page_option', 'login_page_option');
- register_setting('branding_page_option', 'branding_page_option');
- register_setting('maps_page_option', 'maps_page_option');
- register_setting('wc_page_option', 'wc_page_option');
- register_setting('misc_page_option', 'misc_page_option');
- register_setting('sc_page_option', 'sc_page_option');
- }
- function gen_page_callback()
- {
- get_template_part('includes/general/options');
- }
- function front_page_callback()
- {
- echo '<h2 id="tabbed-options-heading">' . __('Import Dummy Content', 'Nellie') . '</h2>';
- echo '<div class="import-heading">' . __('Click the IMPORT button once and fetch the Dummy content', 'Nellie') . '</div>';
- echo '<div class="ac-admin-info note">' . __('PROCESS', 'Nellie') . '</div>';
- echo '<div class="ac-admin-info-show">' . __('Once you click the Import Button, the installer will import all the dummy content as designed in our demo site.
- The import may take several minutes depending on your Internet speed and server configuration. Do not navigate away from this page until the import is complete. You will be properly notified once the import is done.
- Clicking on the Import Button more than once will result in duplicate content in your site. Please avoid that unless you really want that content once again.
- Please be informed that the images shown in the demo site will not be imported. Instead exact dimensional images will be fetched due to media licensing issues. However, you will be able to replace those images with your own once you get the exact dimension as visible on those dummy images.', 'Nellie') . '</div>';
- echo '<div class="import_message">';
- echo '<input type="button" value="' . __('IMPORT', 'Nellie') . '" id="ac_import" class="ac_import"/>';
- echo '<div class="alternate-demo"><h3>' . __('Alternative Method', 'Nellie') . '</h3>
- <div class="alternate-demo-content">' . __('If for some reasons, the <strong>Ajax Demo Importer</strong> does not work (<em>if it takes more than 5 minutes to process</em>), please install the following Plugin from WordPress repository', 'Nellie') . __('<a href="https://wordpress.org/plugins/one-click-demo-import/" target="_blank">One Click Demo Import</a>', 'Nellie') . __('<p>Browse the XML file from Nellie Theme Directory or <a href="http://bit.ly/2lfGbI9" target="_blank">download this from here</a>', 'Nellie') . __('<p> Once you install the recommended Importer Plugin, you will notice a Plugin options page <strong>Import Demo Data</strong> under <em>Appearance</em>. Please visit the Plugin Options page and import the XML file and wait for a while before the Nellie Demo Content is fetched into your site</p>', 'Nellie') . '</div>' . '</div>';
- echo '</div>';
- if (ac_n_get_curr_nellie()) {
- echo '<p class="new-import-errors">' . __('Please be informed that you will see import error messages like <em>some pages and media files already exist</em> since you have already run the importer earlier when you first installed Nellie. Please ignore those errors since you would need to run this once again to import the new pages, menus, custom layouts, AC ShortCodes and so.', 'Nellie') . '</p>';
- }
- echo '<span class="import_issues">' . __('The importer will install all the dummy content. If there is any issues in importing or if the import is not successfully done, please report this to us', 'Nellie') . '</span>';
- }
- function second_page_callback()
- {
- ?>
- <div class="wrap">
- <form method="post" action="options.php">
- <?php
- settings_fields('reading');
- if (!in_array(get_option('blog_charset'), array(
- 'utf8',
- 'utf-8',
- 'UTF8',
- 'UTF-8'
- )))
- add_settings_field('blog_charset', __('Encoding for pages and feeds'), 'options_reading_blog_charset', 'reading', 'default', array(
- 'label_for' => 'blog_charset'
- ));
- ?>
- <?php
- if (!get_pages()):
- ?>
- <input name="show_on_front" type="hidden" value="posts" />
- <table class="form-table">
- <?php
- if ('posts' != get_option('show_on_front')):
- update_option('show_on_front', 'posts');
- endif;
- else:
- if ('page' == get_option('show_on_front') && !get_option('page_on_front') && !get_option('page_for_posts'))
- update_option('show_on_front', 'posts');
- ?>
- <h2 id="tabbed-options-heading"><?php
- _e('Set Homepage and Menu', 'Nellie');
- ?></h2>
- <table class="form-table">
- <p><?php
- _e('Set the Homepage and Nav Menu (<em>as suggested by this theme</em>)', 'Nellie');
- ?></p>
- <div class="ac-admin-info note"><?php
- _e('INFO', 'Nellie');
- ?></div>
- <div class="ac-admin-info-show">
- <?php
- _e('These settings can also be done in these pages -', 'Nellie');
- ?> <a href="<?php
- echo esc_url(admin_url('options-reading.php'));
- ?>"><?php
- _e('Reading');
- ?></a> (<em><?php
- _e('for Homepage select</em>) and', 'Nellie');
- ?> <a href="<?php
- echo esc_url(admin_url('nav-menus.php'));
- ?>"><?php
- _e('Menus', 'Nellie');
- ?></a> (<em><?php
- _e('for Menus select', 'Nellie');
- ?></em>)
- </div>
- <tr>
- <th scope="row"><?php
- _e('Select Homepage', 'Nellie');
- ?></th>
- <td id="front-static-pages"><fieldset><legend class="screen-reader-text"><span><?php
- _e('Select Homepage', 'Nellie');
- ?></span></legend>
- <p><label>
- <input name="show_on_front" type="radio" value="page" class="tog" <?php
- checked('page', get_option('show_on_front'));
- ?> checked/>
- <?php
- printf(__('A <a href="%s">static page</a> (select below)', 'Nellie'), 'edit.php?post_type=page');
- ?>
- </label>
- </p>
- <ul>
- <li><label for="page_on_front"><?php
- printf(__('Homepage: %s', 'Nellie'), wp_dropdown_pages(array(
- 'name' => 'page_on_front',
- 'echo' => 0,
- 'show_option_none' => __('— Select —', 'Nellie'),
- 'option_none_value' => '0',
- 'selected' => get_option('page_on_front')
- )));
- ?></label></li>
- </ul>
- <?php
- if ('page' == get_option('show_on_front') && get_option('page_for_posts') == get_option('page_on_front')):
- ?>
- <div id="front-page-warning" class="error inline"><p><?php
- _e('<strong>Warning:</strong> these pages should not be the same!');
- ?></p></div>
- <?php
- endif;
- ?>
- </fieldset></td>
- </tr>
- <?php
- endif;
- ?>
- <?php
- do_settings_fields('reading', 'default');
- ?>
- </table>
- <?php
- do_settings_sections('reading');
- ?>
- <input type="submit" name="submit" id="submit" class="ac-admin-buttons" value="<?php
- _e('Save Changes');
- ?>" />
- </form>
- </div>
- <!--adding menu-->
- <?php
- if (current_theme_supports('menus')) {
- $locations = get_registered_nav_menus();
- $menu_locations = get_nav_menu_locations();
- }
- $locations = get_registered_nav_menus();
- $menu_locations = get_nav_menu_locations();
- $num_locations = count(array_keys($locations));
- $nav_menus = wp_get_nav_menus();
- $menu_count = count($nav_menus);
- foreach ((array) $nav_menus as $key => $_nav_menu) {
- $nav_menus[$key]->truncated_name = wp_html_excerpt($_nav_menu->name, 40, '…');
- }
- $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'edit';
- switch ($action) {
- case 'add-menu-item':
- check_admin_referer('add-menu_item', 'menu-settings-column-nonce');
- if (isset($_REQUEST['nav-menu-locations']))
- set_theme_mod('nav_menu_locations', array_map('absint', $_REQUEST['menu-locations']));
- elseif (isset($_REQUEST['menu-item']))
- wp_save_nav_menu_items($nav_menu_selected_id, $_REQUEST['menu-item']);
- break;
- case 'update':
- check_admin_referer('update-nav_menu', 'update-nav-menu-nonce');
- foreach ($locations as $location => $description) {
- if ((empty($_POST['menu-locations']) || empty($_POST['menu-locations'][$location])) && isset($menu_locations[$location]) && $menu_locations[$location] == $nav_menu_selected_id)
- unset($menu_locations[$location]);
- }
- if (isset($_POST['menu-locations'])) {
- $new_menu_locations = array_map('absint', $_POST['menu-locations']);
- $menu_locations = array_merge($menu_locations, $new_menu_locations);
- }
- set_theme_mod('nav_menu_locations', $menu_locations);
- case 'locations':
- if (isset($_POST['menu-locations'])) {
- check_admin_referer('save-menu-locations');
- $new_menu_locations = array_map('absint', $_POST['menu-locations']);
- $menu_locations = array_merge($menu_locations, $new_menu_locations);
- set_theme_mod('nav_menu_locations', $menu_locations);
- $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __('Menu locations updated.', 'Nellie') . '</p></div>';
- }
- break;
- }
- ?>
- <div id="menu-locations-wrap">
- <?php
- if (ac_n_get_curr_nellie()) {
- _e('<p>Select <strong>Mob Menu</strong> for Mobile Menu Location and <strong>Nellie 1.4 Menu</strong> for Primary Menu Location</p>');
- }
- ?>
- <form method="post" action="<?php
- echo esc_url(add_query_arg(array(
- 'action' => 'locations'
- ), admin_url('admin.php?page=ac_nellie_options&tab=set_hp_menu_options')));
- ?>">
- <table class="widefat fixed" id="menu-locations-table">
- <thead>
- <tr>
- <th scope="col" class="manage-column column-locations"><?php
- _e('Menu Location', 'Nellie');
- ?></th>
- <th scope="col" class="manage-column column-menus nellie1-4-menus"><?php
- _e('Assigned Menu');
- ?></th>
- </tr>
- </thead>
- <tbody class="menu-locations">
- <?php
- foreach ($locations as $_location => $_name) {
- ?>
- <tr class="menu-locations-row">
- <td class="menu-location-title"><label for="locations-<?php
- echo $_location;
- ?>"><?php
- echo $_name;
- ?></label></td>
- <td class="menu-location-menus">
- <select name="menu-locations[<?php
- echo $_location;
- ?>]" id="locations-<?php
- echo $_location;
- ?>">
- <option value="0"><?php
- printf('— %s —', esc_html__('Select a Menu'));
- ?></option>
- <?php
- foreach ($nav_menus as $menu):
- ?>
- <?php
- $selected = isset($menu_locations[$_location]) && $menu_locations[$_location] == $menu->term_id;
- ?>
- <option <?php
- if ($selected)
- echo 'data-orig="true"';
- ?> <?php
- selected($selected);
- ?> value="<?php
- echo $menu->term_id;
- ?>">
- <?php
- echo wp_html_excerpt($menu->name, 40, '…');
- ?>
- </option>
- <?php
- endforeach;
- ?>
- </select>
- </td><!-- .menu-location-menus -->
- </tr><!-- .menu-locations-row -->
- <?php
- }
- ?>
- </tbody>
- </table>
- <input type="submit" name="submit" id="submit" class="ac-admin-buttons" value="<?php
- _e('Save Changes');
- ?>" />
- <?php
- wp_nonce_field('save-menu-locations');
- ?>
- </form>
- </div><!-- #menu-locations-wrap -->
- <?php
- }
- function footer_page_callback()
- {
- echo '<h2 id="tabbed-options-heading">' . __('Footer Builder', 'Nellie') . '</h2>';
- echo '<div class="dfb-heading">' . __('This theme uses the built-in <a href="https://ayanize.com/product/de-footer-builder/" target="_blank">DE Footer Builder</a>. Click the button below to style or rebuild the footer section', 'Nellie') . '</div>';
- $args = array(
- 'post_type' => 'custom-footer',
- 'post_status' => 'publish'
- );
- $hasposts = get_posts($args);
- if ($hasposts) {
- $args = array(
- 'post_type' => 'custom-footer',
- 'post_status' => 'publish'
- );
- $loop = new WP_Query($args);
- while ($loop->have_posts()):
- $loop->the_post();
- $id = get_the_id();
- endwhile;
- $post_link = get_edit_post_link($id);
- echo '<a class="footer-builder" href="' . $post_link . '">' . __('Footer Builder', 'Nellie') . '</a>';
- } else {
- $new_header_link = admin_url('post-new.php?post_type=custom-footer');
- echo '<a class="footer-builder" href="' . $new_header_link . '">' . __('Create Footer', 'Nellie') . '</a>';
- }
- }
- function code_page_callback()
- {
- echo '<h2 id="tabbed-options-heading">' . __('Custom Styling', 'Nellie') . '</h2>';
- get_template_part('includes/branding/code/options');
- }
- function login_page_callback()
- {
- get_template_part('includes/login/settings-options');
- }
- function branding_page_callback()
- {
- get_template_part('includes/branding/options');
- }
- function maps_page_callback()
- {
- get_template_part('includes/maps/options');
- }
- function wc_page_callback()
- {
- get_template_part('woocommerce/options');
- }
- function misc_page_callback()
- {
- get_template_part('includes/branding/misc/options');
- }
- function sc_page_callback()
- {
- get_template_part('includes/sc/options');
- }
- add_action('admin_init', 'ac_n_found_missing_tabs');
- function ac_n_found_missing_tabs()
- {
- global $current_user;
- $user_id = $current_user->ID;
- if (isset($_GET['ac_n_found_missing_tabs']) && '0' == $_GET['ac_n_found_missing_tabs']) {
- add_user_meta($user_id, 'ac_n_missing_tabs_notice', 'true', true);
- }
- }
- function ac_n_missing_tabs_init()
- {
- global $woocommerce, $current_user;
- $user_id = $current_user->ID;
- if (!ac_n_get_curr_nellie()) {
- return;
- }
- $hide_url = add_query_arg('ac_n_found_missing_tabs', '0');
- if (!get_user_meta($user_id, 'ac_n_missing_tabs_notice') && class_exists('woocommerce')) {
- $output = __('<p class="missing-tabs">Not able to find the <strong>Demo Import</strong> or <strong>Homepage & Menu</strong> Settings Tabs? Visit <strong>Misc</strong> Settings Tab and enable the last option field. <a class="missing-tabs-link" href="' . $hide_url . '">Yes, I know. Don\'t bug me again</a> <a href="#" class="ac_admin_help_text"><span>To make Nellie Options Page less cluttered , Nellie will hide the Demo Import and Homepage & Menu Settings Tabs when their jobs are done. However, if for some reasons, you do not see them or want to bring them back, follow the note here</span></a></p>', 'Nellie');
- echo $output;
- }
- }
- add_action('ac_tabs', 'ac_n_missing_tabs_init');
- function ac_get_theme_n_ver()
- {
- $theme = wp_get_theme('Nellie');
- $version = $theme->get('Version');
- echo $version;
- }
- function ac_n_show_lang_notice()
- {
- global $current_user;
- $user_id = $current_user->ID;
- $show_how = ac_n_show_how_lang();
- $hide_url_3 = add_query_arg('ac_n_lang_nag_ignore_3', '0');
- if (!get_user_meta($user_id, 'ac_wc_ignore_lang_notice_3') && class_exists('woocommerce')) {
- printf(__('<span class="n-new-lang-notice">Nellie is now available in 7 languages. ', 'Nellie') . __('<strong>English, Spanish, Portuguese, German, French, Dutch</strong> and <strong>Italian</strong>. ', 'Nellie') . __('%2$s | <a class="ac-nag-close" href="%1$s">Close</a></span>', 'Nellie'), $hide_url_3, $show_how);
- }
- }
- function ac_n_show_how_lang()
- {
- $content = __('<div id="show_how"><a href="#">Show How</a><span class="show_how_content">Please go to <strong>Settings > General > Site Language</strong> field. (right at the bottom of the page) Select your language and Save changes.</span></div>', 'Nellie');
- return $content;
- }
- function ac_n_lang_nag_ignore()
- {
- global $current_user;
- $user_id = $current_user->ID;
- if (isset($_GET['ac_n_lang_nag_ignore_3']) && '0' == $_GET['ac_n_lang_nag_ignore_3']) {
- add_user_meta($user_id, 'ac_wc_ignore_lang_notice_3', 'true', true);
- }
- }
- add_action('admin_init', 'ac_n_lang_nag_ignore');
- function theme_options_functions()
- {
- ?>
- <div id="ac-panel"><img src="<?php
- echo get_stylesheet_directory_uri() . '/assets/imgs/nellie-dashicon-white.png';
- ?>"><h1><?php
- _e('Nellie Options', 'Nellie');
- ?></h1><span class="nellie-ver"><?php
- ac_get_theme_n_ver();
- ?></span>
- <?php
- ac_n_show_lang_notice();
- ?></div>
- <div class="wrap">
- <?php
- do_action('ac_tabs');
- ?>
- <?php
- settings_errors();
- ?>
- <?php
- $active_tab = isset($_GET['tab']) ? $_GET['tab'] : 'import_demo_options';
- ?>
- <h2 id ="ac-tabbed"class="nav-tab-wrapper">
- <a id="ac-demo-import" href="?page=ac_nellie_options&tab=import_demo_options" class="nav-tab <?php
- echo $active_tab == 'import_demo_options' ? 'nav-tab-active' : '';
- ?>"><?php
- _e('Demo Import', 'Nellie');
- ?></a>
- <a id="ac-hp-menu" href="?page=ac_nellie_options&tab=set_hp_menu_options" class="nav-tab <?php
- echo $active_tab == 'set_hp_menu_options' ? 'nav-tab-active' : '';
- ?>"><?php
- _e('Homepage & Menu', 'Nellie');
- ?></a>
- <a id="ac-gen-settings" href="?page=ac_nellie_options&tab=gen_options" class="nav-tab <?php
- echo $active_tab == 'gen_options' ? 'nav-tab-active' : '';
- ?>"><?php
- _e('General', 'Nellie');
- ?></a>
- <a id="ac-wc-settings" href="?page=ac_nellie_options&tab=wc_options" class="nav-tab <?php
- echo $active_tab == 'wc_options' ? 'nav-tab-active' : '';
- ?>"><?php
- _e('WooCommerce', 'Nellie');
- ?></a>
- <a id="ac-build-footer" href="?page=ac_nellie_options&tab=footer_builder_options" class="nav-tab <?php
- echo $active_tab == 'footer_builder_options' ? 'nav-tab-active' : '';
- ?>"><?php
- _e('Footer Builder', 'Nellie');
- ?></a>
- <a id="ac-login-settings" href="?page=ac_nellie_options&tab=login_options" class="nav-tab <?php
- echo $active_tab == 'login_options' ? 'nav-tab-active' : '';
- ?>"><?php
- _e('Login Page', 'Nellie');
- ?></a>
- <a id="ac-branding-settings" href="?page=ac_nellie_options&tab=branding_options" class="nav-tab <?php
- echo $active_tab == 'branding_options' ? 'nav-tab-active' : '';
- ?>"><?php
- _e('Branding', 'Nellie');
- ?></a>
- <a id="ac-map-settings" href="?page=ac_nellie_options&tab=maps_options" class="nav-tab <?php
- echo $active_tab == 'maps_options' ? 'nav-tab-active' : '';
- ?>"><?php
- _e('Google Map', 'Nellie');
- ?></a>
- <a id="ac-misc-settings" href="?page=ac_nellie_options&tab=misc_options" class="nav-tab <?php
- echo $active_tab == 'misc_options' ? 'nav-tab-active' : '';
- ?>"><?php
- _e('Misc', 'Nellie');
- ?></a>
- <a id="ac-sc-settings" href="?page=ac_nellie_options&tab=sc_options" class="nav-tab <?php
- echo $active_tab == 'sc_options' ? 'nav-tab-active' : '';
- ?>"><?php
- _e('Shortcodes', 'Nellie');
- ?></a>
- <a id="ac-code-settings" href="?page=ac_nellie_options&tab=code_page_options" class="nav-tab <?php
- echo $active_tab == 'code_page_options' ? 'nav-tab-active' : '';
- ?>"><?php
- _e('Customization', 'Nellie');
- ?></a>
- </h2>
- <form method="post" action="options.php">
- <?php
- if ($active_tab == 'import_demo_options') {
- settings_fields('front_page_option');
- do_settings_sections('front_page_option');
- } else if ($active_tab == 'set_hp_menu_options') {
- settings_fields('second_page_option');
- do_settings_sections('second_page_option');
- } else if ($active_tab == 'gen_options') {
- settings_fields('gen_option');
- do_settings_sections('gen_page_option');
- } else if ($active_tab == 'footer_builder_options') {
- settings_fields('footer_page_option');
- do_settings_sections('footer_page_option');
- } else if ($active_tab == 'login_options') {
- settings_fields('login_page_option');
- do_settings_sections('login_page_option');
- } else if ($active_tab == 'branding_options') {
- settings_fields('branding_page_option');
- do_settings_sections('branding_page_option');
- } else if ($active_tab == 'maps_options') {
- settings_fields('maps_page_option');
- do_settings_sections('maps_page_option');
- } else if ($active_tab == 'wc_options') {
- settings_fields('wc_page_option');
- do_settings_sections('wc_page_option');
- } else if ($active_tab == 'misc_options') {
- settings_fields('misc_page_option');
- do_settings_sections('misc_page_option');
- } else if ($active_tab == 'sc_options') {
- settings_fields('sc_page_option');
- do_settings_sections('sc_page_option');
- } else if ($active_tab == 'code_page_options') {
- settings_fields('code_page_option');
- do_settings_sections('code_page_option');
- }
- ?>
- </form>
- </div>
- <?php
- }
- function ac_force_plugin_activation()
- {
- echo '<style>#setting-error-tgmpa {
- width: 100%;height: 100%;position: absolute;z-index: 100;left: 0;z-index: 99999;text-align:center; border: none;
- }#setting-error-tgmpa p{font-size:25px;}.parent-theme {
- display: none;
- }</style>';
- echo '<style>.updated.woocommerce-message.wc-connect {display: none;}</style>';
- }
- function ac_show_select_header()
- {
- global $current_user;
- $user_id = $current_user->ID;
- $header_style = et_get_option('header_style', 'left');
- $hide_url = add_query_arg('ac_nag_ignore', '0');
- if (!get_user_meta($user_id, 'ac_ignore_notice') && class_exists('woocommerce')) {
- if ('centered' !== $header_style) {
- echo '<div class="updated"><p>';
- printf(__('Please select the suggested Header Format & Style. Go to Appearance > Customize > Header & Navigation > Header Format > Header Style and choose "Centered" | <a href="%1$s">Dismiss</a>', 'Nellie'), $hide_url);
- echo "</p></div>";
- }
- }
- }
- function ac_nag_ignore()
- {
- global $current_user;
- $user_id = $current_user->ID;
- if (isset($_GET['ac_nag_ignore']) && '0' == $_GET['ac_nag_ignore']) {
- add_user_meta($user_id, 'ac_ignore_notice', 'true', true);
- }
- }
- function ac_header_centered_default()
- {
- et_update_option('header_style', 'centered');
- }
- function ac_top_search()
- {
- $form = '<div class="search-bg">
- <div class="ac-top-search-form"><form role="search" method="get" id="searchform" action="' . home_url('/') . '" >
- <div>
- <input placeholder="' . __('Search the site....', 'Nellie') . '" type="text" value="' . get_search_query() . '" name="s" id="s" />
- <input type="submit" id="searchsubmit" value="' . esc_attr__('Go', 'Nellie') . '" />
- <span class="close-button"></span>
- </div>
- </form> </div>
- <span class="srch-button"></span>
- </div>';
- return $form;
- }
- function ac_wc_sidebar()
- {
- ob_start();
- $output = dynamic_sidebar('ac-woo-sidebar');
- $output = ob_get_contents();
- ob_end_clean();
- return $output;
- }
- function ac_custom_modules()
- {
- if (class_exists('ET_Builder_Module')) {
- include('inc/modules/blog-ac.php');
- }
- }
- function call_ac_custom_modules()
- {
- global $pagenow;
- $is_admin = is_admin();
- $action_hook = $is_admin ? 'wp_loaded' : 'wp';
- $required_admin_pages = array(
- 'edit.php',
- 'post.php',
- 'post-new.php',
- 'admin.php',
- 'admin-ajax.php'
- );
- $specific_filter_pages = array(
- 'edit.php',
- 'admin.php'
- );
- if (!$is_admin || ($is_admin && in_array($pagenow, $required_admin_pages) && (!in_array($pagenow, $specific_filter_pages)))) {
- add_action($action_hook, 'ac_custom_modules', 9789);
- }
- }
- call_ac_custom_modules();
- function ac_call_custom_gf()
- {
- wp_register_style('ac-gf-playfair', 'https://fonts.googleapis.com/css?family=Playfair+Display:400,400italic,700');
- wp_register_style('ac-gf-lora', 'https://fonts.googleapis.com/css?family=Lora:400,400italic,700');
- wp_register_style('ac-gf-open-sans-condensed', 'https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300');
- wp_register_style('ac-gf-quicksand', 'https://fonts.googleapis.com/css?family=Quicksand:400,700');
- wp_register_style('ac-gf-roboto', 'https://fonts.googleapis.com/css?family=Roboto:400,300');
- wp_enqueue_style('ac-gf-lora');
- wp_enqueue_style('ac-gf-playfair');
- wp_enqueue_style('ac-gf-open-sans-condensed');
- wp_enqueue_style('ac-gf-quicksand');
- wp_enqueue_style('ac-gf-roboto');
- }
- function ac_single_post_check()
- {
- if (is_single()) {
- global $post;
- ?>
- <div class="author-bio">
- <div class="author-bio-img">
- <?php
- $avatar = get_avatar(get_the_author_meta('email'), '150');
- $author_id = get_queried_object()->post_author;
- $username = get_the_author_meta('user_login', $author_id);
- $url = get_author_posts_url($author_id);
- ?>
- <?php
- echo '<a class="ac-author" href="' . $url . '">' . $avatar . '</a>';
- ?>
- </div>
- <div class="author-bio-content">
- <div class="author-info">
- <h3 class="author-bio-title"><?php
- echo et_pb_get_the_author_posts_link();
- ?></h3>
- <p class="author-bio-description"><?php
- echo get_the_author_meta('user_description');
- ?></p>
- <ul class="ac-profile-icons">
- <?php
- $user_site = get_the_author_meta('user_url');
- if ($user_site && $user_site != '') {
- echo '<li class="url"><a href="' . esc_url($user_site) . '"></a></li>';
- }
- $twitter_profile = get_the_author_meta('twitter');
- if ($twitter_profile && $twitter_profile != '') {
- echo '<li class="twitter"><a href="' . esc_url($twitter_profile) . '"></a></li>';
- }
- $facebook_profile = get_the_author_meta('facebook');
- if ($facebook_profile && $facebook_profile != '') {
- echo '<li class="facebook"><a href="' . esc_url($facebook_profile) . '"></a></li>';
- }
- $google_profile = get_the_author_meta('gplus');
- if ($google_profile && $google_profile != '') {
- echo '<li class="google"><a href="' . esc_url($google_profile) . '" rel="author"></a></li>';
- }
- $linkedin_profile = get_the_author_meta('linkedin');
- if ($linkedin_profile && $linkedin_profile != '') {
- echo '<li class="linkedin"><a href="' . esc_url($linkedin_profile) . '"></a></li>';
- }
- $instagram_profile = get_the_author_meta('instagram');
- if ($instagram_profile && $instagram_profile != '') {
- echo '<li class="instagram"><a href="' . esc_url($instagram_profile) . '"></a></li>';
- }
- $pinterest_profile = get_the_author_meta('pinterest');
- if ($pinterest_profile && $pinterest_profile != '') {
- echo '<li class="pinterest"><a href="' . esc_url($pinterest_profile) . '"></a></li>';
- }
- ?>
- </ul>
- </div>
- </div>
- <!--END .author-bio-->
- </div>
- <?php
- }
- }
- add_action('ac_after_content', 'ac_single_post_check');
- function ac_switch_small_logo_header()
- {
- $img = get_option('ac_switch_logo_option');
- $default = get_stylesheet_directory_uri() . '/assets/imgs/logo-scroll.png';
- $url = get_home_url();
- if (get_option('ac_misc_remove_header_smalllogo') == 1) {
- return;
- }
- if (get_option('ac_switch_logo_option')) {
- echo '<div class="small-logo"><a href="' . esc_url($url) . '"><img src="' . $img . '"></a></div>';
- } else {
- echo '<div class="small-logo"><a href="' . esc_url($url) . '"><img src="' . $default . '"></a></div>';
- }
- }
- function ac_modify_contact_methods($profile_fields)
- {
- $profile_fields['twitter'] = __('Twitter');
- $profile_fields['facebook'] = __('Facebook');
- $profile_fields['gplus'] = __('Google+');
- $profile_fields['linkedin'] = __('LinkedIn');
- $profile_fields['instagram'] = __('Instagram');
- $profile_fields['pinterest'] = __('Pinterest');
- return $profile_fields;
- }
- function show_ac_wc_tab()
- {
- if ('publish' == get_post_status('987451248')) {
- echo '<style>#ac-demo-import{display:none}</style>';
- }
- if (get_option('page_on_front') && class_exists('WooCommerce')) {
- echo '<style>#ac-hp-menu{display:none;}</style>';
- }
- }
- function ac_login_placeholder()
- {
- echo '<script type="text/javascript">
- jQuery(document).ready(function(){jQuery(".login form .input, .login input[type=text]").attr("placeholder", "User Name");
- jQuery("#user_pass").attr("placeholder", "User Password");
- });
- </script>';
- }
- function ac_rename_login_register()
- {
- if (get_option('ac_acct_login_register_txt')) {
- echo '<span class="ac-login-pu-text">' . get_option('ac_acct_login_register_txt') . '</span>';
- } else {
- echo '<span class="ac-login-pu-text">' . __('Account', 'Nellie') . '</span>';
- }
- }
- function switch_logo()
- {
- $logo_Param = array(
- 'ac_shop_bg_image' => get_option('ac_shop_bg_image'),
- 'ac_shop_page' => get_permalink(get_option('woocommerce_shop_page_id')),
- 'ac_n_mob_default_menu' => (bool) get_option('ac_n_mob_default_menu'),
- 'ac_gen_cust_header' => (bool) get_option('ac_gen_cust_header')
- );
- wp_localize_script('ac-front-js', 'logoParam', $logo_Param);
- wp_enqueue_script('ac-front-js');
- }
- function ac_misc_settings_register()
- {
- register_setting('misc-settings-group', 'ac_switch_logo_option');
- register_setting('misc-settings-group', 'ac_misc_remove_header_bg');
- register_setting('misc-settings-group', 'ac_misc_remove_header_cart');
- register_setting('misc-settings-group', 'ac_misc_remove_header_loginreg');
- register_setting('misc-settings-group', 'ac_misc_remove_header_smalllogo');
- register_setting('misc-settings-group', 'ac_misc_remove_header_style');
- register_setting('misc-settings-group', 'ac_misc_remove_header_search');
- register_setting('misc-settings-group', 'ac_misc_remove_header_format');
- register_setting('misc-settings-group', 'ac_get_email');
- register_setting('misc-settings-group', 'ac_get_phone');
- register_setting('misc-settings-group', 'ac_misc_disable_search_bar');
- register_setting('misc-settings-group', 'ac_misc_disable_mob_header');
- register_setting('misc-settings-group', 'ac_misc_add_header_bg');
- register_setting('misc-settings-group', 'ac_misc_back_header_menu_tabs');
- }
- function ac_front_login_fail($username)
- {
- $referrer = $_SERVER['HTTP_REFERER'];
- if (!empty($referrer) && !strstr($referrer, 'wp-login') && !strstr($referrer, 'wp-admin')) {
- wp_redirect(home_url('my-account/login-failed/'));
- exit;
- }
- }
- function ac_custom_css_bg()
- {
- $img = get_option('ac_misc_add_header_bg');
- $default = get_stylesheet_directory_uri() . '/assets/imgs/checkered.jpg';
- if ($img) {
- echo '<style>#main-header {background-image: url("' . $img . '");}</style>';
- echo '<style>@media only screen and (max-width:980px){
- #page-container #main-header.et-fixed-header{
- background-image: url("' . $img . '");}}</style>';
- } else {
- echo '<style>#main-header {background-image: url("' . $default . '");</style>';
- echo '<style>@media only screen and (max-width:980px){
- #page-container #main-header.et-fixed-header{
- background-image: url("' . $default . '");}}</style>';
- }
- }
- function ac_custom_css()
- {
- if (get_option('ac_misc_disable_search_bar') == 1) {
- echo '<style>
- @media only screen and (min-width: 980px){
- .pro-srch.stick{position:fixed;max-width:84%;}</style>';
- }
- if (get_option('ac_misc_disable_mob_header') == 1) {
- echo '<style>.et_fixed_nav #main-header {
- position: absolute;
- }</style>';
- }
- }
- function ac_branding_themes($themes)
- {
- $theme_opt_n = get_option('ac_branding_remove_nellie_themes');
- $theme_opt_d = get_option('ac_branding_remove_divi_themes');
- $parent = "Divi";
- $child = "Nellie";
- if ($theme_opt_d) {
- unset($themes[$parent]);
- }
- if ($theme_opt_n) {
- unset($themes[$child]);
- }
- return $themes;
- }
- function ac_header_contacts()
- {
- $email = get_option('ac_get_email');
- $phone = get_option('ac_get_phone');
- echo '<div class="ac-top-contacts">';
- if ($email) {
- echo '<span class="ac-top-email"><a href="mailto:' . $email . '"><span class="content">' . $email . '</span></a></span>';
- }
- if ($phone) {
- echo '<span class="ac-top-phone"><a href="tel:' . $phone . '"><span class="content">' . $phone . '</span></a></span>';
- }
- echo '</div>';
- }
- function ac_wc_mega_menu($atts)
- {
- $atts = shortcode_atts(array(
- 'per_page' => '4',
- 'columns' => '1',
- 'orderby' => 'title',
- 'order' => 'desc',
- 'cat' => '',
- 'operator' => 'IN'
- ), $atts);
- if (!$atts['cat']) {
- return '';
- }
- $ordering_args = WC()->query->get_catalog_ordering_args($atts['orderby'], $atts['order']);
- $meta_query = WC()->query->get_meta_query();
- $query_args = array(
- 'post_type' => 'product',
- 'post_status' => 'publish',
- 'ignore_sticky_posts' => 1,
- 'orderby' => $ordering_args['orderby'],
- 'order' => $ordering_args['order'],
- 'posts_per_page' => $atts['per_page'],
- 'meta_query' => $meta_query
- );
- $query_args = ac_category_args($query_args, $atts['cat'], $atts['operator']);
- if (isset($ordering_args['meta_key'])) {
- $query_args['meta_key'] = $ordering_args['meta_key'];
- }
- $return = ac_product_loop($query_args, $atts, 'product_cat');
- WC()->query->remove_ordering_args();
- return $return;
- }
- function ac_category_args($args, $cat, $operator)
- {
- if (!empty($cat)) {
- $args['tax_query'] = array(
- array(
- 'taxonomy' => 'product_cat',
- 'terms' => array_map('sanitize_title', explode(',', $cat)),
- 'field' => 'slug',
- 'operator' => $operator
- )
- );
- }
- return $args;
- }
- function ac_product_loop($query_args, $atts, $loop_name)
- {
- global $woocommerce_loop;
- $products = new WP_Query(apply_filters('woocommerce_shortcode_products_query', $query_args, $atts, $loop_name));
- $columns = absint($atts['columns']);
- $woocommerce_loop['columns'] = $columns;
- ob_start();
- if ($products->have_posts()):
- ?>
- <?php
- woocommerce_product_loop_start();
- ?>
- <?php
- while ($products->have_posts()):
- $products->the_post();
- ?>
- <?php
- wc_get_template_part('content', 'product');
- ?>
- <?php
- endwhile;
- ?>
- <?php
- woocommerce_product_loop_end();
- ?>
- <?php
- endif;
- woocommerce_reset_loop();
- wp_reset_postdata();
- return '<div class="woocommerce columns-' . $columns . '">' . ob_get_clean() . '</div>';
- }
- function ac_add_options_toolbar($wp_admin_bar)
- {
- if (!is_user_logged_in() || !current_user_can('manage_options') || get_option('ac_branding_hide_this_theme') == 1) {
- return;
- }
- $wp_admin_bar->add_menu(array(
- 'parent' => 'appearance',
- 'id' => 'nellie-opt',
- 'title' => __('Nellie Options', 'Nellie'),
- 'href' => admin_url('admin.php?page=ac_nellie_options')
- ));
- }
- function ac_noindex_404_template_page()
- {
- $option = get_option('404page_page_id');
- if (is_page($option)) {
- echo '<meta name="robots" content="noindex,nofollow">';
- }
- }
- function display_post_type_meta()
- {
- $category = get_the_category();
- $cpt = get_option('ac_branding_rename_project_cpt');
- if (get_post_type() == 'project' && is_archive()) {
- global $post;
- $terms = wp_get_object_terms($post->ID, 'project_category');
- foreach ($terms as $term) {
- $count = $term->count;
- }
- printf(__('<div class="total-cat-posts">Total %1$s : %2$s </div>'), $cpt, $count);
- } else {
- echo '<div class="total-cat-posts">' . __('Total Posts :', 'Nellie') . $category[0]->category_count . '</div>';
- }
- }
- function ac_display_cpt_cat_name()
- {
- if (get_post_type() == 'project' && is_archive()) {
- global $post;
- ob_start();
- $terms = the_terms($post->ID, 'project_category');
- $output = ob_get_contents();
- ob_end_clean();
- printf(__(' <h1 class="cat-lists">Category : <span class="ac-author-tem"> %1$s </span></h1>', 'Nellie'), $output);
- } else {
- $cat = get_the_category_list(', ');
- printf(__(' <h1 class="cat-lists">Category: <span class="ac-author-tem"> %1$s </span></h1>', 'Nellie'), $cat);
- }
- }
- function ac_call_nav_des($item_output, $item, $depth, $args)
- {
- if (!empty($item->description)) {
- $item_output = '<img src="' . $item->description . '">';
- }
- return $item_output;
- }
- add_filter('walker_nav_menu_start_el', 'ac_call_nav_des', 10, 4);
- add_filter('nav_menu_css_class', 'ac_menu_des_bg_class', 10, 2);
- function ac_menu_des_bg_class($classes, $item)
- {
- if (!empty($item->description)) {
- $classes[] = 'menu-bg-img';
- }
- return $classes;
- }
- function ac_mob_menu_media()
- {
- echo '<style>@media only screen and (min-width:1025px){
- .ac-menu {display: block;}.ac-mobile-menu, .ac-default-menu #mob-menu-container{display:none;}} @media only screen and (max-width:1024px){.ac-menu {display: none;}.ac-mobile-menu{display: block;}}
- </style>';
- }
- add_action('wp_head', 'ac_mob_menu_media');
- function css_adjust_1366px()
- {
- if (!wp_is_mobile())
- return;
- echo '<style>@media only screen and (max-width: 1367px){
- .home #main-header {background-color: rgba(0, 0, 0, 0.29);}.container.et_menu_container {z-index: 99; width: 100%; max-width:40%; display: inline-block; vertical-align: middle;}.ac-mobile-menu {display: block;}.ac-menu{display:;}}</style>';
- }
- add_action('wp_head', 'css_adjust_1366px');
- function ac_n_custom_css_default_divi()
- {
- echo '<style>';
- echo '@media only screen and (min-width: 1025px){#main-header.et-fixed-header{background-color:#fff}.home #main-header{background-color:transparent}#top-menu li.current-menu-item>a{color:#fff}.nav li ul{background-color:#111}#top-menu .sub-menu li a{color:#fff;font-family:inherit;text-transform:uppercase;font-size:16px;font-weight:300;letter-spacing:.5px;opacity:1}#main-header.et-fixed-header .logo_container{visibility:hidden;margin-top:-72px;opacity:0}}';
- echo '</style>';
- }
- add_action('wp_head', 'ac_n_custom_css_default_divi', 20);
- if (get_option('ac_misc_remove_header_style') == 1) {
- remove_action('wp_head', 'ac_n_custom_css_default_divi', 20);
- }
- // register a mobile menu
- function wdm_register_mobile_menu() {
- add_theme_support( 'nav-menus' );
- register_nav_menus( array('mobile-menu' => __( 'Mobile Menu', 'wdm' )) );
- }
- add_action( 'init', 'wdm_register_mobile_menu' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement