for posts and comments. add_theme_support( 'automatic-feed-links' ); /* * Let WordPress manage the document title. * By adding theme support, we declare that this theme does not use a * hard-coded tag in the document head, and expect WordPress to * provide it for us. */ add_theme_support( 'title-tag' ); /* * Switches default core markup for search form, comment form, * and comments to output valid HTML5. */ add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' ) ); // This theme uses wp_nav_menu() in one location. register_nav_menu( 'atiframebuilder_top_menu', esc_attr__( 'Header Menu', 'atiframe-builder' ) ); /* * This theme uses a custom image size for featured images, displayed on * "standard" posts and pages. */ add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 600, 725, true ); add_image_size('atiframebuilder_portfolio', 1170, 9999, true); add_image_size('atiframebuilder_thumb', 600, 600, true); add_image_size('atiframebuilder_thumb_300', 300, 300, true); add_image_size('atiframebuilder_long', 1170, 400, true); add_image_size('atiframebuilder_rectangle', 600, 400, true); add_image_size('atiframebuilder_masonry', 300, 600, true); // This theme uses its own gallery styles. add_filter( 'use_default_gallery_style', '__return_false' ); } add_action( 'after_setup_theme', 'atiframebuilder_setup' ); /*------------------------------------*\ Menu and Sidebar \*------------------------------------*/ /* Menu Layout Settings */ function atiframebuilder_set_nav() { wp_nav_menu( array( 'theme_location' => 'atiframebuilder_top_menu', 'menu' => '', 'container' => '', 'container_class' => '', 'container_id' => '', 'menu_class' => '', 'menu_id' => '', 'echo' => true, 'fallback_cb' => '__return_empty_string', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '', 'items_wrap' => '%3$s', 'depth' => 3, 'walker' => '' ) ); } /** * Register 7 widget areas. */ function atiframebuilder_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Left Sidebar', 'atiframe-builder' ), 'id' => '_default_left_sidebar', 'description' => esc_html__( 'Appears in the left section of the site.', 'atiframe-builder' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); register_sidebar( array( 'name' => esc_html__( 'Right Sidebar', 'atiframe-builder' ), 'id' => '_default_right_sidebar', 'description' => esc_html__( 'Appears in the right section of the site.', 'atiframe-builder' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); register_sidebar( array( 'name' => esc_html__( 'Left Blog Sidebar', 'atiframe-builder' ), 'id' => 'blog_default_left_sidebar', 'description' => esc_html__( 'Appears in the left blog section of the site.', 'atiframe-builder' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); register_sidebar( array( 'name' => esc_html__( 'Right Blog Sidebar', 'atiframe-builder' ), 'id' => 'blog_default_right_sidebar', 'description' => esc_html__( 'Appears in the right blog section of the site.', 'atiframe-builder' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); register_sidebar( array( 'name' => esc_html__( 'Left Shop Sidebar', 'atiframe-builder' ), 'id' => 'shop_default_left_sidebar', 'description' => esc_html__( 'Appears in the left shop section of the site.', 'atiframe-builder' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); register_sidebar( array( 'name' => esc_html__( 'Right Shop Sidebar', 'atiframe-builder' ), 'id' => 'shop_default_right_sidebar', 'description' => esc_html__( 'Appears in the left shop section of the site.', 'atiframe-builder' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); } add_action( 'widgets_init', 'atiframebuilder_widgets_init' ); if ( ! function_exists( 'atiframebuilder_fs' ) ) { // Create a helper function for easy SDK access. function atiframebuilder_fs() { global $atiframebuilder_fs; if (!isset($atiframebuilder_fs)) { // Include Freemius SDK. require_once dirname(__FILE__) . '/config/start.php'; $atiframebuilder_fs = fs_dynamic_init( array( 'id' => '2081', 'slug' => 'atiframe-builder', 'type' => 'theme', 'public_key' => 'pk_b8f0b8060172c4fe1a94d47a60925', 'is_premium' => true, 'has_addons' => false, 'has_paid_plans' => true, 'trial' => array( 'days' => 14, 'is_require_payment' => true, ), 'has_affiliation' => 'selected', 'menu' => array( 'slug' => 'welcome', 'first-path' => 'themes.php?page=welcome', 'support' => false, 'parent' => array( 'slug' => 'themes.php', ), ), ) ); } return $atiframebuilder_fs; } // Init Freemius. atiframebuilder_fs(); // Signal that SDK was initiated. do_action( 'atiframebuilder_fs_loaded' ); } /*-----------------------------------------------------------------------------------*/ /* Include Designs Functions /*-----------------------------------------------------------------------------------*/ require_once(get_template_directory() . '/functions/blog.php'); // Functions and layouts for blog require_once(get_template_directory() . '/functions/functions.php'); // General Functions of the theme. Under the hood. require_once(get_template_directory() . '/functions/layout.php'); // General Functions of the theme. Under the hood. require_once(get_template_directory() . '/functions/woocommerce.php'); // Functions for woocommerce and a cart in menu require_once(get_template_directory() . '/functions/footer.php'); // Functions for footer section require_once(get_template_directory() . '/functions/header.php'); // Functions for header section // Change plugins list if inctaller is active if (function_exists('atiframebuilder_welcome_notice')) { require_once ( get_template_directory() . '/inc/plugins-list.php'); } else { require_once ( get_template_directory() . '/inc/plugins-list_f.php'); } add_filter( 'yikes_easy_mailchimp_extender_use_custom_db', 'atiframebuilder_del_red_mailchamp' ); function atiframebuilder_del_red_mailchamp($custom_db){ update_option('yikes_mailchimp_activation_redirect', 'false'); return $custom_db; } add_action('redux/page/secretlab/form/before', 'atiframebuilder_save_installed'); function atiframebuilder_save_installed() { if ( !empty( $_GET['atifrom'] ) && 'atiframe-builder' === $_GET['atifrom'] ) { echo '<div class="updated notice my-acf-notice is-dismissible"><p>'.esc_attr__( "Atiframe themes data was installed successfully", 'atiframe-builder' ).'</p></div>'; } } add_action('comment_form', 'atiframebuilder_comment_checkbox'); function atiframebuilder_comment_checkbox() { echo '<p class="comment-form-ch">'. '<input id="atiframebuilder_ch" name="atiframebuilder_ch" type="checkbox" /> </p>'; } function atiframebuilder_comment_check( $comment_data ) { if( isset( $_POST['atiframebuilder_ch'] ) ) { wp_die( esc_html__( 'Error: please, do not set hidden field', 'atiframe-builder' ) ); } else { return $comment_data; } } add_action( 'pre_comment_on_post', 'atiframebuilder_comment_check' ); function atiframebuilder_free_message() { if ( atiframebuilder_fs()->is_not_paying() ) { echo '<div id="message" class="notice notice-error is-dismissible"><h1>' . esc_html__( 'Atiframe Premium Features', 'atiframe-builder' ) . '</h1>' ; echo '<p>' . esc_html__( 'Upgrade the theme and get visual builder with a real-time preview of header, footer, content, widgets and pop-up windows. Also, you will get extra design templates, support with answer up to 12 hours and real-time preview for mobile/tablet website version!', 'atiframe-builder' ) . '</p>' ; echo '<a class="meta_btn" href="' . esc_url( atiframebuilder_fs()->get_upgrade_url() ) . '">' . __( 'Upgrade Now!', 'atiframe-builder' ) . '</a>' ; echo ' </div>' ; } else { echo '' ; } } add_action( 'contextual_help', 'atiframebuilder_free_message' ); if ( atiframebuilder_fs()->is_not_paying() ) { add_action ( 'kc-top-nav', 'atiframebuilder_rem_kcl_button', 9 ); add_action ( 'kc-switcher-buttons', 'atiframebuilder_rem_kcl_button', 9 ); remove_action ('admin_bar_menu', 'kc_admin_bar', 999); remove_action( 'admin_bar_menu', 'sls_kc_submenu', 2000 ); add_action ( 'admin_bar_menu', 'atiframebuilder_activation_button', 999 ); add_action ( 'init', 'atiframebuilder_rem_kcl_page' ); add_filter( 'kc_topbar_links', 'atiframebuilder_kcl_topbar_links', 10, 1 ); function atiframebuilder_rem_kcl_button(){ global $kc_pro; remove_action ('kc-top-nav', array( $kc_pro, 'switcher_live_editor')); remove_action ('kc-switcher-buttons', array( $kc_pro, 'switcher_live_editor')); echo '<a href="' . atiframebuilder_fs()->get_upgrade_url() . '" class="kc-button red"><i class="sl-paper-plane"></i>' . __( 'Activate Live Editor', 'atiframe-builder' ) . '</a>'; } function atiframebuilder_activation_button( $wp_admin_bar ){ global $post, $wp_the_query, $wp_admin_bar; if (is_admin()) { $screen = get_current_screen(); if( $screen->base == 'post') $wp_admin_bar->add_node( array( 'id' => 'kc-edit', 'title' => '<i class="fa-star"></i> '.__( 'Activate Live Editor', 'atiframe-builder' ), 'href' => atiframebuilder_fs()->get_upgrade_url() ) ); }else{ $current_object = $wp_the_query->get_queried_object(); if ( empty( $current_object ) ) return; if ( ! empty( $current_object->post_type ) && ( $post_type_object = get_post_type_object( $current_object->post_type ) ) && current_user_can( 'edit_post', $current_object->ID ) && $post_type_object->show_in_admin_bar && $edit_post_link = get_edit_post_link( $current_object->ID ) ) { $wp_admin_bar->add_menu( array( 'id' => 'kc-edit', 'title' => '<i class="fa-star"></i> ' . __( 'Activate Live Editor', 'atiframe-builder' ), 'href' => atiframebuilder_fs()->get_upgrade_url() ) ); } } } function atiframebuilder_rem_kcl_page(){ if ( isset( $_GET['kc_action'] ) && !empty( $_GET['kc_action'] ) && $_GET['kc_action'] == 'live-editor' && !empty( $_GET['id'] ) ){ wp_safe_redirect( admin_url('/post.php?action=edit&kc_action=enable_builder&post=' . $_GET['id'] ), 302 ); } } function atiframebuilder_kcl_topbar_links( $actions ) { if (class_exists( 'kc_pro')) { $actions = array_merge ($actions, array( 'kc-pro' => sprintf( '<a href="%1$s">%2$s</a>', esc_url( atiframebuilder_fs()->get_upgrade_url() ), __( 'Activate Live Editor', 'atiframe-builder' ) ) ) ); } return $actions; } }