'Shortcodes Ultimate',
'slug' => 'shortcodes-ultimate',
'required' => false
),
array(
'name' => 'Options Framework',
'slug' => 'options-framework',
'required' => false
),
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' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Sidebar Header 1', 'bernadetta' ),
'id' => 'sidebar-header1',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Sidebar Header 2', 'bernadetta' ),
'id' => 'sidebar-header2',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Sidebar Header 3', 'bernadetta' ),
'id' => 'sidebar-header3',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Sidebar Header 4', 'bernadetta' ),
'id' => 'sidebar-header4',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Sidebar Header 5', 'bernadetta' ),
'id' => 'sidebar-header5',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Sidebar Header 6', 'bernadetta' ),
'id' => 'sidebar-header6',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Sidebar Header 7', 'bernadetta' ),
'id' => 'sidebar-header7',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Sidebar Header 8', 'bernadetta' ),
'id' => 'sidebar-header8',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Sidebar Footer 1', 'bernadetta' ),
'id' => 'sidebar-footer1',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Sidebar Footer 2', 'bernadetta' ),
'id' => 'sidebar-footer2',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Sidebar Footer 3', 'bernadetta' ),
'id' => 'sidebar-footer3',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Sidebar Footer 4', 'bernadetta' ),
'id' => 'sidebar-footer4',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Sidebar Footer 5', 'bernadetta' ),
'id' => 'sidebar-footer5',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Sidebar Footer 6', 'bernadetta' ),
'id' => 'sidebar-footer6',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Sidebar Footer 7', 'bernadetta' ),
'id' => 'sidebar-footer7',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Sidebar Footer 8', 'bernadetta' ),
'id' => 'sidebar-footer8',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
}
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
'
' .
su_do_shortcode( $content, 's' ) .
'
' .
( $atts['image'] != '' && $atts['full_center'] == 'yes' ? '
' : '' ) .
'
';
}
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 '
'. $atts['header_text'] .'
' . su_do_shortcode( $content, 't' ) . '
';
}
function bernadetta_testimonial( $atts = null, $content = null ) {
$atts = shortcode_atts( array(
'image' => '',
'image2x' => '',
'text' => '',
'name' => '',
), $atts, 'bs_row' );
return '
' . $atts['text'] . '
' . $atts['name'] . '
';
}
function bernadetta_bs_row( $atts = null, $content = null ) {
return '
' . su_do_shortcode( $content, 'b' ) . '
';
}
function bernadetta_bs_column( $atts = null, $content = null ) {
$atts = shortcode_atts( array(
'class' => '',
), $atts, 'bs_column' );
return
'
' . su_do_shortcode( $content, 'b' ) . '
';
}
function bernadetta_bs_button( $atts = null, $content = null ) {
$atts = shortcode_atts( array(
'type' => '',
'url' => '',
'label' => '',
'class' => ''
), $atts, 'bs_button' );
return '
' .
$atts['label'] .
' ';
}
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 '
' . $atts['feature1title'] . '
' . $atts['feature1text'] . '
' . $atts['feature2title'] . '
' . $atts['feature2text'] . '
' . $atts['feature3title'] . '
' . $atts['feature3text'] . '
' . $atts['feature4title'] . '
' . $atts['feature4text'] . '
' . $atts['feature1title'] . '
' . $atts['feature1text'] . '
' . $atts['feature2title'] . '
' . $atts['feature2text'] . '
' . $atts['feature3title'] . '
' . $atts['feature3text'] . '
' . $atts['feature4title'] . '
' . $atts['feature4text'] . '
';
}
function bernadetta_get_the_content_by_id( $post2 = 0, $more_link_text = null, $stripteaser = false ) {
global $post;
$post = $post2;
setup_postdata( $post );
$content = get_the_content( __( 'Continue reading →
', 'bernadetta' ), $stripteaser, the_title( '"', '" ' ) );
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 '
';
}
function bernadetta_text_center( $atts = null, $content = null ) {
return
''
. su_do_shortcode( $content, 't' ) .
'
';
}
function bernadetta_text_color( $atts = null, $content = null ) {
$atts = shortcode_atts( array(
'color' => '',
'text_shadow' => '',
), $atts, 'text_color' );
return
''
. su_do_shortcode( $content, 't' ) .
'
';
}
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 = '
show all / ';
foreach ( $matches as $match ) {
$filters .= '
' . $match . ' / ';
}
$filters = substr( $filters, 0, -2 );
$filters .= '
';
return '
' . $filters . '
'
. $content .
'
';
}
function bernadetta_portfolio_item( $atts = null, $content = null ) {
$atts = shortcode_atts( array(
'category' => '',
'image' => '',
'image2x' => '',
'image_type' => '',
'title' => '',
), $atts, 'portfolio_item' );
return '
';
}
function bernadetta_animate( $atts = null, $content = null ) {
return '' . su_do_shortcode( $content, 'a' ) . '
';
}
/*********** 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' );
?>
Display only header image on post/page
ID, 'bernadetta_header-thumbnail-only', true ) == '1' ) {
echo 'checked=checked';
} ?>/>
Do not display title on header image
ID, 'bernadetta_header-thumbnail-notext', true ) == '1' ) {
echo 'checked=checked';
} ?>/>
Display as parallax
ID, 'bernadetta_header-thumbnail-paralax', true ) == '1' ) {
echo 'checked=checked';
} ?>/>
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' );
?>
Size
>small
>wide