'Shortcodes Ultimate', 'slug' => 'shortcodes-ultimate', 'required' => true, ), array( 'name' => 'Options Framework', 'slug' => 'options-framework', 'required' => true, ), array( 'name' => 'WP Retina 2x', 'slug' => 'wp-retina-2x', 'required' => false, ), array( 'name' => 'WP Ajaxify comments', 'slug' => 'wp-ajaxify-comments', 'required' => false, ) ); /* * Array of configuration settings. Amend each line as needed. * * TGMPA will start providing localized text strings soon. If you already have translations of our standard * strings available, please help us make TGMPA even better by giving us access to these translations or by * sending in a pull-request with .po file(s) with the translations. * * Only uncomment the strings in the config array if you want to customize the strings. */ $config = array( 'id' => 'bernadetta', // Unique ID for hashing notices for multiple instances of TGMPA. 'default_path' => '', // Default absolute path to bundled plugins. 'menu' => 'tgmpa-install-plugins', // Menu slug. 'has_notices' => true, // Show admin notices or not. 'dismissable' => false, // If false, a user cannot dismiss the nag message. 'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag. 'is_automatic' => true, // Automatically activate plugins after installation or not. 'message' => '', // Message to output right before the plugins table. ); tgmpa( $plugins, $config ); } add_action( 'init', 'bernadetta_add_editor_styles' ); /** * Apply theme's stylesheet to the visual editor. * * @uses add_editor_style() Links a stylesheet to visual editor * @uses get_stylesheet_uri() Returns URI of theme stylesheet */ function bernadetta_add_editor_styles() { add_editor_style( get_stylesheet_uri() ); } if ( !function_exists( 'bernadetta_setup' ) ) : /** * Sets up theme defaults and registers support for various WordPress features. * * Note that this function is hooked into the after_setup_theme hook, which * runs before the init hook. The init hook is too late for some features, such * as indicating support for post thumbnails. */ function bernadetta_setup() { /* * Make theme available for translation. * Translations can be filed in the /languages/ directory. * If you're building a theme based on Bernadetta, use a find and replace * to change 'bernadetta' to the name of your theme in all the template files. */ load_theme_textdomain( 'bernadetta', get_template_directory() . '/languages' ); // Add default posts and comments RSS feed links to head. 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' ); /* * Enable support for Post Thumbnails on posts and pages. * * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/ */ add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 150, 150, true ); set_post_thumbnail_size( 638, 368, true ); set_post_thumbnail_size( 300, 160, true ); set_post_thumbnail_size( 730, 999999, true ); set_post_thumbnail_size( 1110, 999999, true ); add_image_size( 'post-thumbnail', 266, 266, true ); add_image_size( 'blog-square', 350, 350, true ); add_image_size( 'blog-large', 730, 400, true ); add_image_size( 'blog-medium', 430, 250, true ); add_image_size( 'blog-full', 1110, 1798, true ); add_image_size( 'blog-full_width', 1843, 1138, true ); add_image_size( 'blog-masonry-small', 438, 378, true ); add_image_size( 'blog-masonry-wide', 922, 378, true ); add_image_size( 'blog-small', 75, 75, true ); // This theme uses wp_nav_menu() in one location. register_nav_menus( array( 'primary' => esc_html__( 'Primary', 'bernadetta' ), ) ); /* * Switch 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', ) ); /* * Enable support for Post Formats. * See https://developer.wordpress.org/themes/functionality/post-formats/ */ add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link', ) ); // Set up the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'bernadetta_custom_background_args', array( 'default-color' => 'ffffff', 'default-image' => '', ) ) ); } endif; add_action( 'after_setup_theme', 'bernadetta_setup' ); /** * Set the content width in pixels, based on the theme's design and stylesheet. * * Priority 0 to make it available to lower priority callbacks. * * @global int $content_width */ function bernadetta_content_width() { $GLOBALS['content_width'] = apply_filters( 'bernadetta_content_width', 640 ); } add_action( 'after_setup_theme', 'bernadetta_content_width', 0 ); add_filter('intermediate_image_sizes_advanced', 'bernadetta_intermediate_image_sizes_advanced', 10, 2); // if uploading already a retina image, don't create thumbnails function bernadetta_intermediate_image_sizes_advanced($sizes, $metadata) { if (strpos($metadata['file'], '@2x.') !== FALSE) { return array(); } else { return $sizes; } } /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ function bernadetta_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Sidebar Right', 'bernadetta' ), 'id' => 'sidebar-1', 'description' => '', 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>', ) ); register_sidebar( array( 'name' => esc_html__( 'Sidebar Header 1', 'bernadetta' ), 'id' => 'sidebar-header1', 'description' => '', 'before_widget' => '<section id="%1$s" class="widget %2$s ' . (of_get_option('header_1_one', '0') == '1' ? '' : 'col-xs-6 col-sm-4 col-md-3') .'">', 'after_widget' => '</section>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>', ) ); register_sidebar( array( 'name' => esc_html__( 'Sidebar Header 2', 'bernadetta' ), 'id' => 'sidebar-header2', 'description' => '', 'before_widget' => '<section id="%1$s" class="widget %2$s ' . (of_get_option('header_2_one', '0') == '1' ? '' : 'col-xs-6 col-sm-4 col-md-3') .'">', 'after_widget' => '</section>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>', ) ); register_sidebar( array( 'name' => esc_html__( 'Sidebar Header 3', 'bernadetta' ), 'id' => 'sidebar-header3', 'description' => '', 'before_widget' => '<section id="%1$s" class="widget %2$s ' . (of_get_option('header_3_one', '0') == '1' ? '' : 'col-xs-6 col-sm-4 col-md-3') .'">', 'after_widget' => '</section>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>', ) ); register_sidebar( array( 'name' => esc_html__( 'Sidebar Header 4', 'bernadetta' ), 'id' => 'sidebar-header4', 'description' => '', 'before_widget' => '<section id="%1$s" class="widget %2$s ' . (of_get_option('header_4_one', '0') == '1' ? '' : 'col-xs-6 col-sm-4 col-md-3') .'">', 'after_widget' => '</section>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>', ) ); register_sidebar( array( 'name' => esc_html__( 'Sidebar Header 5', 'bernadetta' ), 'id' => 'sidebar-header5', 'description' => '', 'before_widget' => '<section id="%1$s" class="widget %2$s ' . (of_get_option('header_5_one', '0') == '1' ? '' : 'col-xs-6 col-sm-4 col-md-3') .'">', 'after_widget' => '</section>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>', ) ); register_sidebar( array( 'name' => esc_html__( 'Sidebar Header 6', 'bernadetta' ), 'id' => 'sidebar-header6', 'description' => '', 'before_widget' => '<section id="%1$s" class="widget %2$s ' . (of_get_option('header_6_one', '0') == '1' ? '' : 'col-xs-6 col-sm-4 col-md-3') .'">', 'after_widget' => '</section>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>', ) ); register_sidebar( array( 'name' => esc_html__( 'Sidebar Header 7', 'bernadetta' ), 'id' => 'sidebar-header7', 'description' => '', 'before_widget' => '<section id="%1$s" class="widget %2$s ' . (of_get_option('header_7_one', '0') == '1' ? '' : 'col-xs-6 col-sm-4 col-md-3') .'">', 'after_widget' => '</section>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>', ) ); register_sidebar( array( 'name' => esc_html__( 'Sidebar Header 8', 'bernadetta' ), 'id' => 'sidebar-header8', 'description' => '', 'before_widget' => '<section id="%1$s" class="widget %2$s ' . (of_get_option('header_8_one', '0') == '1' ? '' : 'col-xs-6 col-sm-4 col-md-3') .'">', 'after_widget' => '</section>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>', ) ); register_sidebar( array( 'name' => esc_html__( 'Sidebar Footer 1', 'bernadetta' ), 'id' => 'sidebar-footer1', 'description' => '', 'before_widget' => '<section id="%1$s" class="widget %2$s ' . (of_get_option('footer_1_one', '0') == '1' ? '' : 'col-xs-6 col-sm-4 col-md-3') .'">', 'after_widget' => '</section>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>', ) ); register_sidebar( array( 'name' => esc_html__( 'Sidebar Footer 2', 'bernadetta' ), 'id' => 'sidebar-footer2', 'description' => '', 'before_widget' => '<section id="%1$s" class="widget %2$s ' . (of_get_option('footer_2_one', '0') == '1' ? '' : 'col-xs-6 col-sm-4 col-md-3') .'">', 'after_widget' => '</section>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>', ) ); register_sidebar( array( 'name' => esc_html__( 'Sidebar Footer 3', 'bernadetta' ), 'id' => 'sidebar-footer3', 'description' => '', 'before_widget' => '<section id="%1$s" class="widget %2$s ' . (of_get_option('footer_3_one', '0') == '1' ? '' : 'col-xs-6 col-sm-4 col-md-3') .'">', 'after_widget' => '</section>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>', ) ); register_sidebar( array( 'name' => esc_html__( 'Sidebar Footer 4', 'bernadetta' ), 'id' => 'sidebar-footer4', 'description' => '', 'before_widget' => '<section id="%1$s" class="widget %2$s ' . (of_get_option('footer_4_one', '0') == '1' ? '' : 'col-xs-6 col-sm-4 col-md-3') .'">', 'after_widget' => '</section>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>', ) ); register_sidebar( array( 'name' => esc_html__( 'Sidebar Footer 5', 'bernadetta' ), 'id' => 'sidebar-footer5', 'description' => '', 'before_widget' => '<section id="%1$s" class="widget %2$s ' . (of_get_option('footer_5_one', '0') == '1' ? '' : 'col-xs-6 col-sm-4 col-md-3') .'">', 'after_widget' => '</section>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>', ) ); register_sidebar( array( 'name' => esc_html__( 'Sidebar Footer 6', 'bernadetta' ), 'id' => 'sidebar-footer6', 'description' => '', 'before_widget' => '<section id="%1$s" class="widget %2$s ' . (of_get_option('footer_6_one', '0') == '1' ? '' : 'col-xs-6 col-sm-4 col-md-3') .'">', 'after_widget' => '</section>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>', ) ); register_sidebar( array( 'name' => esc_html__( 'Sidebar Footer 7', 'bernadetta' ), 'id' => 'sidebar-footer7', 'description' => '', 'before_widget' => '<section id="%1$s" class="widget %2$s ' . (of_get_option('footer_7_one', '0') == '1' ? '' : 'col-xs-6 col-sm-4 col-md-3') .'">', 'after_widget' => '</section>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>', ) ); register_sidebar( array( 'name' => esc_html__( 'Sidebar Footer 8', 'bernadetta' ), 'id' => 'sidebar-footer8', 'description' => '', 'before_widget' => '<section id="%1$s" class="widget %2$s ' . (of_get_option('footer_8_one', '0') == '1' ? '' : 'col-xs-6 col-sm-4 col-md-3') .'">', 'after_widget' => '</section>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>', ) ); } add_action( 'widgets_init', 'bernadetta_widgets_init' ); /** * Enqueue scripts and styles. */ function bernadetta_scripts() { wp_enqueue_style( 'bernadetta-style', get_stylesheet_uri() ); wp_enqueue_script( 'bernadetta-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20151215', true ); wp_enqueue_script( 'bernadetta-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'wp_enqueue_scripts', 'bernadetta_scripts' ); /** * Implement the Custom Header feature. */ require get_template_directory() . '/inc/custom-header.php'; /** * Custom template tags for this theme. */ require get_template_directory() . '/inc/template-tags.php'; /** * Custom functions that act independently of the theme templates. */ require get_template_directory() . '/inc/extras.php'; /** * Customizer additions. */ require get_template_directory() . '/inc/customizer.php'; /** * Load Jetpack compatibility file. */ require get_template_directory() . '/inc/jetpack.php'; /* * Helper function to return the theme option value. If no value has been saved, it returns $default. * Needed because options are saved as serialized strings. * * This code allows the theme to work without errors if the Options Framework plugin has been disabled. */ if ( !function_exists( 'of_get_option' ) ) { function of_get_option( $name, $default = false ) { $optionsframework_settings = get_option( 'optionsframework' ); // Gets the unique option id $option_name = $optionsframework_settings['id']; if ( get_option( $option_name ) ) { $options = get_option( $option_name ); } if ( isset( $options[$name] ) ) { return $options[$name]; } else { return $default; } } } delete_transient( 'su/generator/popup' ); add_action( 'admin_enqueue_scripts', 'bernadetta_admin_enqueue_scripts' ); function bernadetta_admin_enqueue_scripts() { wp_register_script( 'bernadetta-admin-js', get_template_directory_uri() . '/assets/js/admin.js', array( 'jquery' ) ); $translation_array = array( 'theme_uri' => get_template_directory_uri() ); wp_localize_script( 'bernadetta-admin-js', 'config', $translation_array ); wp_enqueue_script( 'bernadetta-admin-js' ); if ( function_exists( 'wp_enqueue_media' ) ) wp_enqueue_media(); wp_register_style( 'bernadetta-admin-css', get_template_directory_uri() . '/assets/css/admin.css' ); wp_enqueue_style( 'bernadetta-admin-css' ); } /*********** ENQUEUE SCRIPTS ***************/ function bernadetta_enqueue_scripts() { if ( !is_admin() ) { wp_reset_query(); wp_enqueue_script( 'jquery', false, array(), false, true ); wp_register_script( 'bernadetta-prettyphoto', get_template_directory_uri() . '/assets/js/jquery.prettyPhoto.js', array( 'jquery' ), false, true ); wp_enqueue_script( 'bernadetta-prettyphoto' ); wp_register_script( 'bernadetta-bootstrap', get_template_directory_uri() . '/assets/js/bootstrap.min.js', array( 'jquery' ), false, true ); wp_enqueue_script( 'bernadetta-bootstrap' ); wp_register_script( 'bernadetta-bootstrap-dropdown', get_template_directory_uri() . '/assets/js/jquery.bootstrap-dropdown-hover.min.js', array( 'bernadetta-bootstrap' ), false, true ); wp_enqueue_script( 'bernadetta-bootstrap-dropdown' ); wp_register_script( 'bernadetta-flickity', get_template_directory_uri() . '/assets/js/flickity.pkgd.js', array( 'jquery' ), false, true ); wp_enqueue_script( 'bernadetta-flickity' ); wp_register_script( 'bernadetta-isotope', get_template_directory_uri() . '/assets/js/isotope.pkgd.min.js', array( 'jquery' ), false, true ); wp_enqueue_script( 'bernadetta-isotope' ); wp_register_script( 'bernadetta-debounced', get_template_directory_uri() . '/assets/js/jquery.debouncedresize.js', array( 'jquery', 'bernadetta-isotope' ), false, true ); wp_enqueue_script( 'bernadetta-debounced' ); wp_register_script( 'bernadetta-skrollr', get_template_directory_uri() . '/assets/js/skrollr.min.js', array( 'jquery', 'bernadetta-isotope', 'bernadetta-flickity' ), false, true ); wp_enqueue_script( 'bernadetta-skrollr' ); wp_register_script( 'bernadetta-skroll-reveal', get_template_directory_uri() . '/assets/js/scrollreveal.min.js', array( 'jquery', 'bernadetta-isotope', 'bernadetta-flickity', 'bernadetta-skrollr' ), false, true ); wp_enqueue_script( 'bernadetta-skroll-reveal' ); wp_register_script( 'bernadetta-custom', get_template_directory_uri() . '/assets/js/custom.js', array( 'jquery', 'bernadetta-isotope', 'bernadetta-flickity', 'bernadetta-skrollr', 'bernadetta-skroll-reveal' ), false, true ); wp_enqueue_script( 'bernadetta-custom' ); } } add_action( 'init', 'bernadetta_enqueue_scripts' ); /*********** CUSTOM SHORTCODES ***************/ function bernadetta_su_data_groups( $groups ) { $groups['bernadetta'] = __( 'Bernadetta Theme', 'bernadetta' ); return $groups; } function bernadetta_su_data_shortcodes( $shortcodes ) { $post_list = array(); $post_list_obj = get_posts( 'sort_column=post_parent,menu_order' ); $post_list[''] = 'Select a post:'; foreach ( $post_list_obj as $post ) { $post_list[$post->ID] = $post->post_title; } $shortcodes['section'] = array( 'name' => __( 'Container Section', 'bernadetta' ), 'desc' => __( 'Container Section', 'bernadetta' ), 'group' => 'bernadetta', 'function' => 'bernadetta_section', 'type' => 'wrap', 'atts' => array( 'image' => array( 'default' => '', 'type' => 'upload', 'name' => __( 'Background Image', 'bernadetta' ) ), 'image2x' => array( 'default' => '', 'type' => 'upload', 'name' => __( 'High-resolution image (optional)', 'bernadetta' ) ), 'is_paralax' => array( 'default' => 'no', 'type' => 'bool', 'name' => __( 'Parallax?', 'bernadetta' ) ), 'full_center' => array( 'default' => 'yes', 'type' => 'bool', 'name' => __( 'Full center?', 'bernadetta' ) ), 'full_width' => array( 'default' => 'yes', 'type' => 'bool', 'name' => __( 'Full width?', 'bernadetta' ) ), 'max_height' => array( 'min' => '0', 'max' => '8000', 'step' => '1', 'default' => '0', 'type' => 'number', 'name' => __( 'Max height (in pixels), or 0 for full height', 'bernadetta' ) ), 'background_color' => array( 'default' => 'white', 'type' => 'select', 'values' => array( 'primary' => __( 'Primary', 'bernadetta' ), 'secondary' => __( 'Secondary', 'bernadetta' ), 'white' => __( 'White', 'bernadetta' ), 'lightest_gray' => __( 'Lightest gray', 'bernadetta' ), 'light gray' => __( 'Light gray', 'bernadetta' ), 'dark_gray' => __( 'Dark gray', 'bernadetta' ), 'black' => __( 'Black', 'bernadetta' ) ), 'name' => __( 'Background color', 'bernadetta' ) ), 'hide_background_xs' => array( 'default' => 'no', 'type' => 'bool', 'name' => __( 'Hide background image on extra small devices', 'bernadetta' ) ), 'hide_background_sm' => array( 'default' => 'no', 'type' => 'bool', 'name' => __( 'Hide background image on small devices', 'bernadetta' ) ), 'margin_top' => array( 'min' => '0', 'max' => '200', 'step' => '1', 'default' => '0', 'type' => 'number', 'name' => __( 'Margin top (in pixels)', 'bernadetta' ) ), 'margin_bottom' => array( 'min' => '0', 'max' => '200', 'step' => '1', 'default' => '0', 'type' => 'number', 'name' => __( 'Margin bottom (in pixels)', 'bernadetta' ) ), ) ); $shortcodes['testimonials'] = array( 'name' => __( 'Testimonials', 'bernadetta' ), 'desc' => __( 'Testimonials Section', 'bernadetta' ), 'group' => 'bernadetta', 'function' => 'bernadetta_testimonials', 'type' => 'wrap', 'atts' => array( 'header_text' => array ( 'type' => 'text', 'name' => 'Header text', 'default' => 'What Our Clients Say About Us' ), 'margin_top' => array( 'min' => '0', 'max' => '200', 'step' => '1', 'default' => '0', 'type' => 'number', 'name' => __( 'Margin top (in pixels)', 'bernadetta' ) ), 'margin_bottom' => array( 'min' => '0', 'max' => '200', 'step' => '1', 'default' => '0', 'type' => 'number', 'name' => __( 'Margin bottom (in pixels)', 'bernadetta' ) ), 'background_color' => array( 'default' => 'white', 'type' => 'select', 'values' => array( 'primary' => __( 'Primary', 'bernadetta' ), 'secondary' => __( 'Secondary', 'bernadetta' ), 'white' => __( 'White', 'bernadetta' ), 'lightest_gray' => __( 'Lightest gray', 'bernadetta' ), 'light gray' => __( 'Light gray', 'bernadetta' ), 'dark_gray' => __( 'Dark gray', 'bernadetta' ), 'black' => __( 'Black', 'bernadetta' ) ), 'name' => __( 'Background color', 'bernadetta' ) ) ) ); $shortcodes['testimonial'] = array( 'name' => __( 'Testimonial', 'bernadetta' ), 'desc' => __( 'Testimonial Item', 'bernadetta' ), 'group' => 'bernadetta', 'function' => 'bernadetta_testimonial', 'type' => 'single', 'atts' => array( 'image' => array( 'default' => '', 'type' => 'upload', 'name' => __( 'Image', 'bernadetta' ) ), 'image2x' => array( 'default' => '', 'type' => 'upload', 'name' => __( 'Retina Image', 'bernadetta' ) ), 'text' => array( 'default' => '', 'type' => 'textarea', 'name' => __( 'Testimonial text', 'bernadetta' ) ), 'name' => array( 'default' => '', 'type' => 'text', 'name' => __( 'Name', 'bernadetta' ) ), ) ); $shortcodes['portfolio'] = array( 'name' => __( 'Portfolio', 'bernadetta' ), 'desc' => __( 'Portfolio Section', 'bernadetta' ), 'group' => 'bernadetta', 'function' => 'bernadetta_portfolio', 'type' => 'wrap', 'atts' => array( 'fluid' => array( 'default' => 'no', 'type' => 'bool', 'name' => __( 'Fluid?', 'bernadetta' ) ), 'margin_top' => array( 'min' => '0', 'max' => '200', 'step' => '1', 'default' => '0', 'type' => 'number', 'name' => __( 'Margin top (in pixels)', 'bernadetta' ) ), 'margin_bottom' => array( 'min' => '0', 'max' => '200', 'step' => '1', 'default' => '0', 'type' => 'number', 'name' => __( 'Margin bottom (in pixels)', 'bernadetta' ) ), 'background_color' => array( 'default' => 'white', 'type' => 'select', 'values' => array( 'primary' => __( 'Primary', 'bernadetta' ), 'secondary' => __( 'Secondary', 'bernadetta' ), 'white' => __( 'White', 'bernadetta' ), 'lightest_gray' => __( 'Lightest gray', 'bernadetta' ), 'light gray' => __( 'Light gray', 'bernadetta' ), 'dark_gray' => __( 'Dark gray', 'bernadetta' ), 'black' => __( 'Black', 'bernadetta' ) ), 'name' => __( 'Background color', 'bernadetta' ) ) ) ); $shortcodes['portfolio_item'] = array( 'name' => __( 'Portfolio Item', 'bernadetta' ), 'desc' => __( 'Portfolio Item', 'bernadetta' ), 'group' => 'bernadetta', 'function' => 'bernadetta_portfolio_item', 'type' => 'wrap', 'atts' => array( 'category' => array( 'default' => 'category', 'type' => 'text', 'name' => 'Portfolio item category' ), 'image' => array( 'default' => '', 'type' => 'upload', 'name' => __( 'Image', 'bernadetta' ) ), 'image2x' => array( 'default' => '', 'type' => 'upload', 'name' => __( 'Retina Image', 'bernadetta' ) ), 'image_type' => array( 'default' => '', 'type' => 'select', 'values' => array( 'small' => __( 'Small', 'bernadetta' ), 'large' => __( 'Large', 'bernadetta' ), ), 'name' => __( 'Large or small image preview', 'bernadetta' ) ), 'title' => array( 'default' => '', 'type' => 'text', 'name' => __( 'Title', 'bernadetta' ) ), ) ); $shortcodes['features'] = array( 'name' => __( 'Features section', 'bernadetta' ), 'desc' => __( 'Features section', 'bernadetta' ), 'group' => 'bernadetta', 'function' => 'bernadetta_features', 'type' => 'wrap', 'atts' => array( 'feature1title' => array( 'default' => '', 'type' => 'text', 'name' => __( 'Feature 1 Title', 'bernadetta' ) ), 'feature1icon' => array( 'default' => '', 'type' => 'text', 'name' => __( 'Feature 1 Icon (fa-xxx)', 'bernadetta' ) ), 'feature1text' => array( 'default' => '', 'type' => 'text', 'name' => __( 'Feature 1 Text', 'bernadetta' ) ), 'feature2title' => array( 'default' => '', 'type' => 'text', 'name' => __( 'Feature 2 Title', 'bernadetta' ) ), 'feature2icon' => array( 'default' => '', 'type' => 'text', 'name' => __( 'Feature 2 Icon (fa-xxx)', 'bernadetta' ) ), 'feature2text' => array( 'default' => '', 'type' => 'text', 'name' => __( 'Feature 2 Text', 'bernadetta' ) ), 'feature3title' => array( 'default' => '', 'type' => 'text', 'name' => __( 'Feature 3 Title', 'bernadetta' ) ), 'feature3icon' => array( 'default' => '', 'type' => 'text', 'name' => __( 'Feature 3 Icon (fa-xxx)', 'bernadetta' ) ), 'feature3text' => array( 'default' => '', 'type' => 'text', 'name' => __( 'Feature 3 Text', 'bernadetta' ) ), 'feature4title' => array( 'default' => '', 'type' => 'text', 'name' => __( 'Feature 4 Title', 'bernadetta' ) ), 'feature4icon' => array( 'default' => '', 'type' => 'text', 'name' => __( 'Feature 4 Icon (fa-xxx)', 'bernadetta' ) ), 'feature4text' => array( 'default' => '', 'type' => 'text', 'name' => __( 'Feature 4 Text', 'bernadetta' ) ), 'image' => array( 'default' => '', 'type' => 'upload', 'name' => __( 'Image in the center', 'bernadetta' ) ), 'image2x' => array( 'default' => '', 'type' => 'upload', 'name' => __( 'Retina Image in the center', 'bernadetta' ) ), 'margin_top' => array( 'min' => '0', 'max' => '200', 'step' => '1', 'default' => '0', 'type' => 'number', 'name' => __( 'Margin top (in pixels)', 'bernadetta' ) ), 'margin_bottom' => array( 'min' => '0', 'max' => '200', 'step' => '1', 'default' => '0', 'type' => 'number', 'name' => __( 'Margin bottom (in pixels)', 'bernadetta' ) ), 'background_color' => array( 'default' => 'white', 'type' => 'select', 'values' => array( 'primary' => __( 'Primary', 'bernadetta' ), 'secondary' => __( 'Secondary', 'bernadetta' ), 'white' => __( 'White', 'bernadetta' ), 'lightest_gray' => __( 'Lightest gray', 'bernadetta' ), 'light gray' => __( 'Light gray', 'bernadetta' ), 'dark_gray' => __( 'Dark gray', 'bernadetta' ), 'black' => __( 'Black', 'bernadetta' ) ), 'name' => __( 'Background color', 'bernadetta' ) ) ) ); $shortcodes['bs_row'] = array( 'name' => __( 'Row', 'bernadetta' ), 'desc' => __( 'Bootstrap Row', 'bernadetta' ), 'group' => 'bernadetta', 'function' => 'bernadetta_bs_row', 'type' => 'wrap' ); $shortcodes['text_center'] = array( 'name' => __( 'Centered text', 'bernadetta' ), 'desc' => __( 'Centered text', 'bernadetta' ), 'group' => 'bernadetta', 'function' => 'bernadetta_text_center', 'type' => 'wrap' ); $shortcodes['bs_column'] = array( 'name' => __( 'Column', 'bernadetta' ), 'desc' => __( 'Bootstrap Column', 'bernadetta' ), 'group' => 'bernadetta', 'function' => 'bernadetta_bs_column', 'type' => 'wrap', 'atts' => array( 'class' => array( 'default' => 'col-sm-1', 'type' => 'text', 'name' => __( 'Column class', 'bernadetta' ) ) ) ); $shortcodes['bs_button'] = array( 'name' => __( 'Button', 'bernadetta' ), 'desc' => __( 'Bootstrap Button', 'bernadetta' ), 'group' => 'bernadetta', 'function' => 'bernadetta_bs_button', 'type' => 'single', 'atts' => array( 'type' => array( 'default' => 'primary', 'type' => 'select', 'values' => array( 'primary' => __( 'Primary', 'bernadetta' ), 'secondary' => __( 'Secondary', 'bernadetta' ), ), 'name' => __( 'Type of button', 'bernadetta' ) ), 'url' => array( 'default' => 'http://', 'type' => 'text', 'name' => __( 'URL', 'bernadetta' ) ), 'label' => array( 'default' => '', 'type' => 'text', 'name' => __( 'Label', 'bernadetta' ) ), 'class' => array( 'default' => '', 'type' => 'text', 'name' => __( 'Additional class', 'bernadetta' ) ) ) ); $shortcodes['text_color'] = array( 'name' => __( 'Text color', 'bernadetta' ), 'desc' => __( 'Applies text color from the color scheme', 'bernadetta' ), 'group' => 'bernadetta', 'function' => 'bernadetta_text_color', 'type' => 'wrap', 'atts' => array( 'color' => array( 'default' => 'color_black', 'type' => 'select', 'values' => array( 'primary' => __( 'Primary', 'bernadetta' ), 'secondary' => __( 'Secondary', 'bernadetta' ), 'white' => __( 'White', 'bernadetta' ), 'lightest_gray' => __( 'Lightest gray', 'bernadetta' ), 'light gray' => __( 'Light gray', 'bernadetta' ), 'dark_gray' => __( 'Dark gray', 'bernadetta' ), 'black' => __( 'Black', 'bernadetta' ) ), 'name' => __( 'Color', 'bernadetta' ) ), 'text_shadow' => array( 'default' => 'none', 'type' => 'select', 'values' => array( 'none' => __( 'None', 'bernadetta' ), 'primary' => __( 'Primary', 'bernadetta' ), 'secondary' => __( 'Secondary', 'bernadetta' ), 'white' => __( 'White', 'bernadetta' ), 'lightest_gray' => __( 'Lightest gray', 'bernadetta' ), 'light gray' => __( 'Light gray', 'bernadetta' ), 'dark_gray' => __( 'Dark gray', 'bernadetta' ), 'black' => __( 'Black', 'bernadetta' ) ), 'name' => __( 'Text shadow', 'bernadetta' ) ), ) ); $shortcodes['featured_post'] = array( 'name' => __( 'Featured Post', 'bernadetta' ), 'desc' => __( 'Featured Post', 'bernadetta' ), 'group' => 'bernadetta', 'function' => 'bernadetta_featured_post', 'type' => 'single', 'atts' => array( 'post_id' => array( 'default' => '', 'type' => 'select', 'values' => $post_list, 'name' => __( 'Post', 'bernadetta' ) ), ) ); $shortcodes['scroll_reveal'] = array( 'name' => __( 'Scroll Reveal', 'bernadetta' ), 'desc' => __( 'Scroll Reveal Animation', 'bernadetta' ), 'group' => 'bernadetta', 'function' => 'bernadetta_animate', 'type' => 'wrap', 'atts' => array() ); return $shortcodes; } add_filter( 'su/data/groups', 'bernadetta_su_data_groups' ); add_filter( 'su/data/shortcodes', 'bernadetta_su_data_shortcodes' ); function bernadetta_get_color( $color_type ) { $color_primary = of_get_option( 'color_primary', '#3498db' ); if ( trim( $color_primary ) == '' ) { $color_primary = '#3498db'; } $color_secondary = of_get_option( 'color_secondary', '#2ecc71' ); if ( trim( $color_secondary ) == '' ) { $color_secondary = '#2ecc71'; } $color_black = of_get_option( 'color_black', '#333' ); if ( trim( $color_black ) == '' ) { $color_black = '#333'; } $color_dark_gray = of_get_option( 'color_dark_gray', '#777' ); if ( trim( $color_dark_gray ) == '' ) { $color_dark_gray = '#777'; } $color_light_gray = of_get_option( 'color_light_gray', '#bababa' ); if ( trim( $color_light_gray ) == '' ) { $color_light_gray = '#bababa'; } $color_lightest_gray = of_get_option( 'color_lightest_gray', '#fafafa' ); if ( trim( $color_lightest_gray ) == '' ) { $color_lightest_gray = '#fafafa'; } $color_white = of_get_option( 'color_white', '#fff' ); if ( trim( $color_white ) == '' ) { $color_white = '#fff'; } if ( $color_type == 'primary' ) { return $color_primary; } if ( $color_type == 'secondary' ) { return $color_secondary; } if ( $color_type == 'black' ) { return $color_black; } if ( $color_type == 'dark_gray' ) { return $color_dark_gray; } if ( $color_type == 'light_gray' ) { return $color_light_gray; } if ( $color_type == 'lightest_gray' ) { return $color_lightest_gray; } if ( $color_type == 'white' ) { return $color_white; } return '#fff'; } function bernadetta_section( $atts = null, $content = null ) { $atts = shortcode_atts( array( 'image' => '', 'image2x' => '', 'is_paralax' => 'no', 'margin_top' => 0, 'margin_bottom' => 0, 'full_center' => 'yes', 'full_width' => 'yes', 'max_height' => 0, 'background_color' => 'white', 'hide_background_xs' => 'no', 'hide_background_sm' => 'no' ), $atts, 'section' ); return '<div data-retina-src="'.$atts['image2x'].'" class="possible-retina hero ' . ( $atts['full_center'] == 'yes' ? ' hero-center ' : ' ' ) . ( $atts['hide_background_xs'] == 'yes' ? ' hide-bg-xs ' : ' ' ) . ( $atts['hide_background_sm'] == 'yes' ? ' hide-bg-sm ' : ' ' ) . ' " style="margin-top: ' . $atts['margin_top'] . 'px; margin-bottom: ' . $atts['margin_bottom'] . 'px; background-image: url(\'' . addslashes( $atts['image'] ) . '\'); ' . ( $atts['max_height'] != 0 ? 'max-height: ' . $atts['max_height'] . 'px; ' : ' ' ) . 'background-color: ' . bernadetta_get_color( $atts['background_color'] ) . '; ' . '" ' . ( $atts['is_paralax'] == 'yes' ? 'data-type="background" data-speed="10"' : '' ) . '> <div class="clearfix content ' . ( $atts['full_width'] == 'yes' ? 'container-fluid' : 'container' ) . '"> <div class="slogan ' . ( $atts['full_center'] == 'yes' ? 'slogan-center' : '' ) . '" style="' . ( $atts['image'] == '' ? 'position: static;' : '' ) . ( $atts['full_center'] != 'yes' || $atts['image'] == '' ? 'transform: none; -webkit-transform: none; -ms-transform: none;' : '' ) . ( $atts['full_center'] != 'yes' ? 'position: static;' : ' ' ) . '">' . su_do_shortcode( $content, 's' ) . '</div>' . ( $atts['image'] != '' && $atts['full_center'] == 'yes' ? '<img alt="" class="img-responsive" src="' . $atts['image'] . '" style="visibility: hidden;' . ( $atts['max_height'] != 0 ? 'max-height: ' . $atts['max_height'] . 'px; ' : ' ' ) . '"/>' : '' ) . '</div> </div>'; } function bernadetta_testimonials( $atts = null, $content = null ) { $atts = shortcode_atts( array( 'margin_top' => 0, 'margin_bottom' => 0, 'background_color' => 'white', 'header_text' => 'What Our Clients Say About Us' ), $atts, 'testimonials' ); return ' <div class="testimonials clearfix" style="margin-top: ' . $atts['margin_top'] . 'px; margin-bottom: ' . $atts['margin_bottom'] . 'px; background-color: ' . bernadetta_get_color( $atts['background_color'] ) . '; "> <div class="container-fluid"> <div class="row"> <div class="col-xs-12 text-center"> <h3>'. $atts['header_text'] .'</h3> </div> </div> <div class="row"> <div class="col-xs-12 testimonials-content"> ' . su_do_shortcode( $content, 't' ) . ' </div> </div> </div> </div>'; } function bernadetta_testimonial( $atts = null, $content = null ) { $atts = shortcode_atts( array( 'image' => '', 'image2x' => '', 'text' => '', 'name' => '', ), $atts, 'bs_row' ); return ' <div class="gallery-cell"> <div class="testimonial"> <img class="img-responsive testimonial-avatar possible-retina-img" data-retina-src="'.$atts['image2x'].'" src="' . $atts['image'] . '" alt="' . $atts['name'] . '"> <div> <q class="testimonial-quote"> ' . $atts['text'] . ' </q> <span class="testimonial-author"> ' . $atts['name'] . ' </span> </div> </div> </div>'; } function bernadetta_bs_row( $atts = null, $content = null ) { return ' <div class="row"> ' . su_do_shortcode( $content, 'b' ) . ' </div>'; } function bernadetta_bs_column( $atts = null, $content = null ) { $atts = shortcode_atts( array( 'class' => '', ), $atts, 'bs_column' ); return '<div class="' . $atts['class'] . '"> ' . su_do_shortcode( $content, 'b' ) . ' </div>'; } function bernadetta_bs_button( $atts = null, $content = null ) { $atts = shortcode_atts( array( 'type' => '', 'url' => '', 'label' => '', 'class' => '' ), $atts, 'bs_button' ); return ' <a class="btn btn-' . $atts['type'] . ' ' . $atts['class'] . ' " href="' . $atts['url'] . '">' . $atts['label'] . '</a>'; } function bernadetta_features( $atts = null, $content = null ) { $atts = shortcode_atts( array( 'feature1title' => '', 'feature1icon' => '', 'feature1text' => '', 'feature2title' => '', 'feature2icon' => '', 'feature2text' => '', 'feature3title' => '', 'feature3icon' => '', 'feature3text' => '', 'feature4title' => '', 'feature4icon' => '', 'feature4text' => '', 'image' => '', 'image2x' => '', 'margin_top' => 0, 'margin_bottom' => 0, 'background_color' => 'white' ), $atts, 'features' ); return ' <section class="features" style="margin-top: ' . $atts['margin_top'] . 'px; margin-bottom: ' . $atts['margin_bottom'] . 'px; background-color: ' . bernadetta_get_color( $atts['background_color'] ) . '"> <div class="container"> <div class="row vertical-align visible-xs visible-sm hidden-md hidden-lg"> <div class="col-xs-12 feature"> <table> <tr> <td><i class="fa ' . $atts['feature1icon'] . ' fa-4x"></i></td> <td><h4>' . $atts['feature1title'] . '</h4></td> </tr> <tr> <td colspan="2"> ' . $atts['feature1text'] . ' </td> </tr> </table> </div> <div class="col-xs-12 feature"> <table> <tr> <td><i class="fa ' . $atts['feature2icon'] . ' fa-4x"></i></td> <td><h4>' . $atts['feature2title'] . '</h4></td> </tr> <tr> <td colspan="2"> ' . $atts['feature2text'] . ' </td> </tr> </table> </div> <div class="col-xs-12 feature"> <img class="img-responsive possible-retina-img" alt="features" src="' . $atts['image'] . '" data-retina-src="'.$atts['image2x'].'" /> </div> <div class="col-xs-12 feature"> <table> <tr> <td><i class="fa ' . $atts['feature3icon'] . ' fa-4x"></i></td> <td><h4>' . $atts['feature3title'] . '</h4></td> </tr> <tr> <td colspan="2"> ' . $atts['feature3text'] . ' </td> </tr> </table> </div> <div class="col-xs-12 feature"> <table> <tr> <td><i class="fa ' . $atts['feature4icon'] . ' fa-4x"></i></td> <td><h4>' . $atts['feature4title'] . '</h4></td> </tr> <tr> <td colspan="2"> ' . $atts['feature4text'] . ' </td> </tr> </table> </div> </div> <div class="row vertical-align hidden-xs hidden-sm visible-md visible-lg"> <div class="col-md-3"> <div class="row"> <div class="col-md-12 feature"> <table> <tr> <td><i class="fa ' . $atts['feature1icon'] . ' fa-4x"></i></td> <td><h4>' . $atts['feature1title'] . '</h4></td> </tr> <tr> <td colspan="2"> ' . $atts['feature1text'] . ' </td> </tr> </table> </div> </div> <div class="row"> <div class="col-md-12 feature"> <table> <tr> <td><i class="fa ' . $atts['feature2icon'] . ' fa-4x"></i></td> <td><h4>' . $atts['feature2title'] . '</h4></td> </tr> <tr> <td colspan="2"> ' . $atts['feature2text'] . ' </td> </tr> </table> </div> </div> </div> <div class="col-md-6"> <div class="row"> <div class="col-md-12"> <img class="img-responsive possible-retina-img" alt="features" src="' . $atts['image'] . '" data-retina-src="'.$atts['image2x'].'" /> </div> </div> </div> <div class="col-md-3"> <div class="row"> <div class="col-md-12 feature"> <table> <tr> <td><i class="fa ' . $atts['feature3icon'] . ' fa-4x"></i></td> <td><h4>' . $atts['feature3title'] . '</h4></td> </tr> <tr> <td colspan="2"> ' . $atts['feature3text'] . ' </td> </tr> </table> </div> </div> <div class="row"> <div class="col-md-12 feature"> <table> <tr> <td><i class="fa ' . $atts['feature4icon'] . ' fa-4x"></i></td> <td><h4>' . $atts['feature4title'] . '</h4></td> </tr> <tr> <td colspan="2"> ' . $atts['feature4text'] . ' </td> </tr> </table> </div> </div> </div> </div> </div> </section> '; } function get_the_content_by_id( $post2 = 0, $more_link_text = null, $stripteaser = false ) { global $post; $post = $post2; setup_postdata( $post ); $content = get_the_content( __( '<div>Continue reading <span class="meta-nav">→</span></div>', 'bernadetta' ), $stripteaser, the_title( '<span class="screen-reader-text">"', '"</span>' ) ); wp_reset_postdata( $post ); return $content; } function bernadetta_featured_post( $atts = null, $content = null ) { $atts = shortcode_atts( array( 'post_id' => '', ), $atts, 'featured_post' ); $post = get_post( $atts['post_id'] ); return ' <div class="col-md-4"> <div class="blog-item"> <a href="' . esc_url( get_the_permalink( $post ) ) . '">' . get_the_post_thumbnail( $post, 'blog-square', array( 'class' => 'img-responsive' ) ) . '</a> <article class="blog-text"> <h4><a href="' . esc_url( get_the_permalink( $post ) ) . '" rel="bookmark">' . get_the_title( $post ) . '</a></h4> ' . get_the_content_by_id( $post ) . ' <div class="blog-bottom"> <i class="fa fa-calendar"></i> ' . get_the_date( '', $post ) . ' <span class="pull-right"><i class="fa fa-comment"></i> ' . get_comments_number( $post ) . '</span> </div> </article> </div> </div>'; } function bernadetta_text_center( $atts = null, $content = null ) { return '<div class="text-center">' . su_do_shortcode( $content, 't' ) . '</div>'; } function bernadetta_text_color( $atts = null, $content = null ) { $atts = shortcode_atts( array( 'color' => '', 'text_shadow' => '', ), $atts, 'text_color' ); return '<div class="color-' . $atts['color'] . ' text-shadow-' . $atts['text_shadow'] . '">' . su_do_shortcode( $content, 't' ) . '</div>'; } function bernadetta_portfolio( $atts = null, $content = null ) { $atts = shortcode_atts( array( 'fluid' => 'no', 'margin_top' => 0, 'margin_bottom' => 0, 'background_color' => 'white' ), $atts, 'portfolio' ); $content = su_do_shortcode( $content, 'p' ); $matches = array(); preg_match_all( '/data-category="(.*)"/', $content, $matches, PREG_PATTERN_ORDER ); $matches = array_unique( $matches[1] ); $filters = '<div class="filters-group"> <a class="filter" data-filter="*">show all</a> / '; foreach ( $matches as $match ) { $filters .= '<a class="filter" data-filter=".' . $match . '">' . $match . '</a> / '; } $filters = substr( $filters, 0, -2 ); $filters .= '</div>'; return ' <div class="portfolio" style="margin-top: ' . $atts['margin_top'] . 'px; margin-bottom: ' . $atts['margin_bottom'] . 'px; background-color: ' . bernadetta_get_color( $atts['background_color'] ) . '"> <div class="container'.($atts['fluid'] == 'yes' ? '-fluid' : '').'"> ' . $filters . ' <div class="row portfolio-items">' . $content . '</div> </div> </div>'; } function bernadetta_portfolio_item( $atts = null, $content = null ) { $atts = shortcode_atts( array( 'category' => '', 'image' => '', 'image2x' => '', 'image_type' => '', 'title' => '', ), $atts, 'portfolio_item' ); return ' <div class="item ' . ( $atts['image_type'] == 'large' ? 'col-sm-6 col-xs-12' : 'col-sm-3 col-xs-6' ) . ' ' . $atts['category'] . '" data-category="' . $atts['category'] . '"> <a title="' . su_do_shortcode( $content, 'p' ) . '" data-rel="prettyPhoto" href="' . $atts['image'] . '"> <div class="item-wrap"> <img class="img-responsive possible-retina-img" data-retina-src="'.$atts['image2x'].'" src="' . $atts['image'] . '" alt="' . $atts['title'] . '"> </div> <span class="magnifier"></span> </a> </div> '; } function bernadetta_animate( $atts = null, $content = null ) { return '<div class="animate">' . su_do_shortcode( $content, 'a' ) . '</div>'; } /*********** CUSTOM META BOXES ***************/ add_action( 'add_meta_boxes', 'bernadetta_add_meta_boxes' ); function bernadetta_add_meta_boxes() { add_meta_box( 'bernadetta-masonry-size', __( 'Masonry Item Size', 'bernadetta' ), 'bernadetta_masonry_size', 'post', 'side', 'high' ); add_meta_box( 'bernadetta-header_thumbnail', __( 'Header Thumbnail', 'bernadetta' ), 'bernadetta_header_thumbnail', array( 'post', 'page' ), 'side', 'high' ); } function bernadetta_header_thumbnail( $post = null ) { $values = get_post_custom( $post->ID ); wp_nonce_field( 'bernadetta_header_nonce', 'header_meta_box_nonce' ); ?> <p class="hide-if-no-js"> <a title="Set Header Image" href="javascript:;" id="set-header-thumbnail">Set header image</a> </p> <div id="featured-header-image-container" class="hidden"> <img src="<?php echo get_post_meta( $post->ID, 'header-thumbnail-src', true ); ?>" alt="<?php echo get_post_meta( $post->ID, 'header-thumbnail-alt', true ); ?>" title="<?php echo get_post_meta( $post->ID, 'header-thumbnail-title', true ); ?>"/> </div><!-- #featured-header-image-container --> <p class="hide-if-no-js hidden"> <a title="Remove header Image" href="javascript:;" id="remove-header-thumbnail">Remove featured image</a> </p><!-- .hide-if-no-js --> <p class="hide-if-no-js"> <a title="Set Retina Header Image" href="javascript:;" id="set-header-thumbnail2x">Set Retina header image</a> </p> <div id="featured-header-image2x-container" class="hidden"> <img src="<?php echo get_post_meta( $post->ID, 'header-thumbnail2x-src', true ); ?>" alt="<?php echo get_post_meta( $post->ID, 'header-thumbnail2x-alt', true ); ?>" title="<?php echo get_post_meta( $post->ID, 'header-thumbnail2x-title', true ); ?>"/> </div><!-- #featured-header-image2x-container --> <p class="hide-if-no-js hidden"> <a title="Remove header Image 2x" href="javascript:;" id="remove-header-thumbnail2x">Remove retina featured image</a> </p><!-- .hide-if-no-js --> <p id="featured-header-image-info"> <input type="hidden" id="header-thumbnail-src" name="header-thumbnail-src" value="<?php echo get_post_meta( $post->ID, 'header-thumbnail-src', true ); ?>"/> <input type="hidden" id="header-thumbnail-title" name="header-thumbnail-title" value="<?php echo get_post_meta( $post->ID, 'header-thumbnail-title', true ); ?>"/> <input type="hidden" id="header-thumbnail-alt" name="header-thumbnail-alt" value="<?php echo get_post_meta( $post->ID, 'header-thumbnail-alt', true ); ?>"/> </p><!-- #featured-header-image-meta --> <p id="featured-header-image2x-info"> <input type="hidden" id="header-thumbnail2x-src" name="header-thumbnail2x-src" value="<?php echo get_post_meta( $post->ID, 'header-thumbnail2x-src', true ); ?>"/> <input type="hidden" id="header-thumbnail2x-title" name="header-thumbnail2x-title" value="<?php echo get_post_meta( $post->ID, 'header-thumbnail2x-title', true ); ?>"/> <input type="hidden" id="header-thumbnail2x-alt" name="header-thumbnail2x-alt" value="<?php echo get_post_meta( $post->ID, 'header-thumbnail2x-alt', true ); ?>"/> </p><!-- #featured-header-image-meta --> <p> <label for="header-thumbnail-only">Display <b>only</b> header image on post/page</label> <input type="checkbox" id="header-thumbnail-only" name="header-thumbnail-only" <?php if ( get_post_meta( $post->ID, 'header-thumbnail-only', true ) == '1' ) { echo 'checked=checked'; } ?>/> </p> <p> <label for="header-thumbnail-notext">Do <b>not</b> display title on header image</b></label> <input type="checkbox" id="header-thumbnail-notext" name="header-thumbnail-notext" <?php if ( get_post_meta( $post->ID, 'header-thumbnail-notext', true ) == '1' ) { echo 'checked=checked'; } ?>/> </p> <p> <label for="header-thumbnail-paralax">Display as parallax</label> <input type="checkbox" id="header-thumbnail-paralax" name="header-thumbnail-paralax" <?php if ( get_post_meta( $post->ID, 'header-thumbnail-paralax', true ) == '1' ) { echo 'checked=checked'; } ?>/> </p> <p id="header-thumbnail-height-par"> <label for="header-thumbnail-height">Header height (in pixels)</label> <input type="text" id="header-thumbnail-height" name="header-thumbnail-height" value="<?php echo get_post_meta( $post->ID, 'header-thumbnail-height', true ); ?>"/> </p> <?php } add_action( 'save_post', 'bernadetta_header_thumbnail_save' ); function bernadetta_header_thumbnail_save( $post_id ) { if ( !isset( $_POST['header_meta_box_nonce'] ) || !wp_verify_nonce( $_POST['header_meta_box_nonce'], 'bernadetta_header_nonce' ) ) return; if ( !current_user_can( 'edit_post' ) ) return; if ( isset( $_REQUEST['header-thumbnail-src'] ) ) { update_post_meta( $post_id, 'header-thumbnail-src', sanitize_text_field( $_REQUEST['header-thumbnail-src'] ) ); } if ( isset( $_REQUEST['header-thumbnail-title'] ) ) { update_post_meta( $post_id, 'header-thumbnail-title', sanitize_text_field( $_REQUEST['header-thumbnail-title'] ) ); } if ( isset( $_REQUEST['header-thumbnail-alt'] ) ) { update_post_meta( $post_id, 'header-thumbnail-alt', sanitize_text_field( $_REQUEST['header-thumbnail-alt'] ) ); } if ( isset( $_REQUEST['header-thumbnail2x-src'] ) ) { update_post_meta( $post_id, 'header-thumbnail2x-src', sanitize_text_field( $_REQUEST['header-thumbnail2x-src'] ) ); } if ( isset( $_REQUEST['header-thumbnail2x-title'] ) ) { update_post_meta( $post_id, 'header-thumbnail2x-title', sanitize_text_field( $_REQUEST['header-thumbnail2x-title'] ) ); } if ( isset( $_REQUEST['header-thumbnail2x-alt'] ) ) { update_post_meta( $post_id, 'header-thumbnail2x-alt', sanitize_text_field( $_REQUEST['header-thumbnail2x-alt'] ) ); } if ( isset ( $_POST['header-thumbnail-paralax'] ) ) { update_post_meta( $post_id, 'header-thumbnail-paralax', sanitize_text_field( '1' ) ); } else { update_post_meta( $post_id, 'header-thumbnail-paralax', sanitize_text_field( '0' ) ); } if ( isset ( $_POST['header-thumbnail-notext'] ) ) { update_post_meta( $post_id, 'header-thumbnail-notext', sanitize_text_field( '1' ) ); } else { update_post_meta( $post_id, 'header-thumbnail-notext', sanitize_text_field( '0' ) ); } if ( isset ( $_POST['header-thumbnail-only'] ) ) { update_post_meta( $post_id, 'header-thumbnail-only', sanitize_text_field( '1' ) ); } else { update_post_meta( $post_id, 'header-thumbnail-only', sanitize_text_field( '0' ) ); } if ( isset ( $_POST['header-thumbnail-height'] ) ) { update_post_meta( $post_id, 'header-thumbnail-height', sanitize_text_field( $_POST['header-thumbnail-height'] ) ); } } function bernadetta_masonry_size( $post ) { $values = get_post_custom( $post->ID ); $selected = isset( $values['bernadetta_meta_masonry_size'] ) ? esc_attr( $values['bernadetta_meta_masonry_size'][0] ) : ''; wp_nonce_field( 'bernadetta_meta_masonry_size_nonce', 'masonry_meta_box_nonce' ); ?> <p> <label for="bernadetta_meta_masonry_size">Size</label> <select name="bernadetta_meta_masonry_size" id="bernadetta_meta_masonry_size"> <option value="small" <?php selected( $selected, 'medium' ); ?>>small</option> <option value="wide" <?php selected( $selected, 'wide' ); ?>>wide</option> </select> </p> <?php } add_action( 'save_post', 'bernadetta_masonry_box_save' ); function bernadetta_masonry_box_save( $post_id ) { if ( !isset( $_POST['masonry_meta_box_nonce'] ) || !wp_verify_nonce( $_POST['masonry_meta_box_nonce'], 'bernadetta_meta_masonry_size_nonce' ) ) return; if ( !current_user_can( 'edit_post' ) ) return; if ( isset( $_POST['bernadetta_meta_masonry_size'] ) ) update_post_meta( $post_id, 'bernadetta_meta_masonry_size', esc_attr( $_POST['bernadetta_meta_masonry_size'] ) ); }