themename = 'butterfly-abode'; $this->style_uri = get_template_directory_uri().'/css'; $this->script_uri = get_template_directory_uri().'/js'; $this->image_uri = get_template_directory_uri().'/images'; add_action('after_setup_theme', array( $this, 'theme_supports' )); add_action('widgets_init', array( $this, 'theme_sidebars' )); add_filter( 'wp_title', array( $this, 'page_title' ) ); add_action('wp_enqueue_scripts', array( $this, 'theme_imports' )); add_action('admin_enqueue_scripts', array( $this, 'admin_imports' )); add_action( 'add_meta_boxes', array( $this, 'bfly_post_meta_box' )); add_action( 'save_post', array( $this, 'bfly_post_save_meta_box_data' )); if( !function_exists( 'the_field' ) && empty( get_option( 'butterfly-abode-notice-dismissed' ) ) ) { add_action('wp_ajax_butterfly_abode_dismiss_notice', array( $this, 'hide_notice' )); add_action( 'admin_notices', array( $this, 'admin_notice' ) ); } } function page_title($title) { if( empty( $title ) && ( is_home() || is_front_page() ) ) { return __( 'Home', 'butterfly-abode' ) . ' | ' . __(get_bloginfo( 'description', 'butterfly-abode' )); } return $title; } function theme_supports() { register_nav_menu( 'header-menu',__('Header Menu','butterfly-abode') ); // add_theme_support( 'post-formats', array( 'video', 'gallery' ) ); add_theme_support( 'title-tag' ); add_theme_support( 'post-thumbnails' ); add_theme_support( 'automatic-feed-links' ); if ( ! isset( $content_width ) ) $content_width = 900; load_theme_textdomain( 'butterfly-abode', get_template_directory().'/languages' ); } function admin_notice() { ?>
Upgrade to Butterfly Abode Premium version to get extended functionality and advanced customization options.', 'butterfly-abode' ); ?>
'; echo '
'; } function bfly_post_save_meta_box_data( $post_id ) { if ( ! isset( $_POST['bfly_post_meta_box_nonce'] ) ) { return; } if ( ! wp_verify_nonce( $_POST['bfly_post_meta_box_nonce'], 'bfly_post_save_meta_box_data' ) ) { return; } if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; } if ( isset( $_POST['post_type'] ) && 'page' == $_POST['post_type'] ) { if ( ! current_user_can( 'edit_page', $post_id ) ) { return; } } else { if ( ! current_user_can( 'edit_post', $post_id ) ) { return; } } $show_in_slider = sanitize_text_field( $_POST['show_in_slider'] ); update_post_meta( $post_id, 'show_in_slider', $show_in_slider ); // $arr = array(); // if (isset($_POST['bfly_post'])) // { // $arr = $_POST['bfly_post']; // } // foreach ($arr as $key => $value) // { // $val = sanitize_text_field($value); // update_post_meta( $post_id, $key, $val ); // } } } $butterfly = new Butterfly(); require_once('customizer.php');