'; ?>
';
endif;
} ?>
%1$s %2$s %3$s %4$s %5$s %6$s %7$s',
(
'on' === $show_author
? sprintf( __( 'by %s', 'et_builder' ), et_pb_get_the_author_posts_link() )
: ''
),
(
( 'on' === $show_author && 'on' === $show_date )
? ' | '
: ''
),
(
'on' === $show_date
? sprintf( __( '%s', 'et_builder' ), get_the_date( $meta_date ) )
: ''
),
(
(( 'on' === $show_author || 'on' === $show_date ) && 'on' === $show_categories)
? ' | '
: ''
),
(
'on' === $show_categories
? get_the_category_list(', ')
: ''
),
(
(( 'on' === $show_author || 'on' === $show_date || 'on' === $show_categories ) && 'on' === $show_comments)
? ' | '
: ''
),
(
'on' === $show_comments
? sprintf( _nx( '1 Comment', '%s Comments', get_comments_number(), '', 'et_builder' ), number_format_i18n( get_comments_number() ) )
: ''
)
);
}
$post_content = get_the_content();
// do not display the content if it contains Blog or Portfolio modules to avoid infinite loops
if ( ! has_shortcode( $post_content, 'et_pb_blog' ) && ! has_shortcode( $post_content, 'et_pb_portfolio' ) ) {
if ( 'on' === $show_content ) {
global $more;
// page builder doesn't support more tag, so display the_content() in case of post made with page builder
if ( et_pb_is_pagebuilder_used( get_the_ID() ) ) {
$more = 1;
the_content();
} else {
$more = null;
the_content( __( 'read more...', 'et_builder' ) );
}
} else {
if ( has_excerpt() ) {
the_excerpt();
} else {
truncate_post( 270 );
}
}
} else if ( has_excerpt() ) {
the_excerpt();
}
if ( 'on' !== $show_content ) {
$more = 'on' == $show_more ? sprintf( '
%2$s' , esc_url( get_permalink() ), __( 'read more', 'et_builder' ) ) : '';
echo $more;
}
?>
';
$container_is_closed = true;
if ( function_exists( 'wp_pagenavi' ) )
wp_pagenavi();
else
get_template_part( 'includes/navigation', 'index' );
}
wp_reset_query();
} else {
get_template_part( 'includes/no-results', 'index' );
}
$posts = ob_get_contents();
ob_end_clean();
$class = " et_pb_module et_pb_bg_layout_{$background_layout}";
$output = sprintf(
'
%2$s
%4$s',
( 'on' === $fullwidth ? 'et_pb_posts' : 'et_pb_blog_grid clearfix' ),
$posts,
esc_attr( $class ),
( ! $container_is_closed ? '
' : '' ),
( '' !== $module_id ? sprintf( ' id="%1$s"', esc_attr( $module_id ) ) : '' ),
( '' !== $module_class ? sprintf( ' %1$s', esc_attr( $module_class ) ) : '' ),
( 'on' !== $fullwidth ? ' data-columns' : '' )
);
if ( 'on' !== $fullwidth )
$output = sprintf( '
%1$s
', $output );
return $output;
}
}
new ET_Builder_Module_Blog;
class ET_Builder_Module_Shop extends ET_Builder_Module {
function init() {
$this->name = __( 'Shop', 'et_builder' );
$this->slug = 'et_pb_shop';
$this->whitelisted_fields = array(
'type',
'posts_number',
'columns_number',
'include_categories',
'orderby',
'admin_label',
'module_id',
'module_class',
'sale_badge_color',
'icon_hover_color',
'hover_overlay_color',
'hover_icon',
);
$this->fields_defaults = array(
'type' => array( 'recent' ),
'posts_number' => array( '12', 'add_default_setting' ),
'columns_number' => array( '0' ),
'orderby' => array( 'menu_order' ),
);
$this->main_css_element = '%%order_class%%.et_pb_shop';
$this->advanced_options = array(
'fonts' => array(
'title' => array(
'label' => __( 'Title', 'et_builder' ),
'css' => array(
'main' => "{$this->main_css_element} .woocommerce ul.products li.product h3",
),
),
'price' => array(
'label' => __( 'Price', 'et_builder' ),
'css' => array(
'main' => "{$this->main_css_element} .woocommerce ul.products li.product .price, {$this->main_css_element} .woocommerce ul.products li.product .price .amount",
),
'line_height' => array(
'range_settings' => array(
'min' => '1',
'max' => '100',
'step' => '1',
),
),
),
),
);
$this->custom_css_options = array(
'product' => array(
'label' => __( 'Product', 'et_builder' ),
'selector' => 'li.product',
),
'onsale' => array(
'label' => __( 'Onsale', 'et_builder' ),
'selector' => 'li.product .onsale',
),
'image' => array(
'label' => __( 'Image', 'et_builder' ),
'selector' => '.et_shop_image',
),
'overlay' => array(
'label' => __( 'Overlay', 'et_builder' ),
'selector' => '.et_overlay',
),
'title' => array(
'label' => __( 'Title', 'et_builder' ),
'selector' => 'li.product h3',
),
'rating' => array(
'label' => __( 'Rating', 'et_builder' ),
'selector' => '.star-rating',
),
'price' => array(
'label' => __( 'Price', 'et_builder' ),
'selector' => 'li.product .price',
),
);
}
function get_fields() {
$fields = array(
'type' => array(
'label' => __( 'Type', 'et_builder' ),
'type' => 'select',
'option_category' => 'basic_option',
'options' => array(
'recent' => __( 'Recent Products', 'et_builder' ),
'featured' => __( 'Featured Products', 'et_builder' ),
'sale' => __( 'Sale Products', 'et_builder' ),
'best_selling' => __( 'Best Selling Products', 'et_builder' ),
'top_rated' => __( 'Top Rated Products', 'et_builder' ),
'product_category' => __( 'Product Category', 'et_builder' ),
),
'affects' => array(
'input[name="et_pb_include_categories"]',
),
'description' => __( 'Choose which type of products you would like to display.', 'et_builder' ),
),
'posts_number' => array(
'label' => __( 'Posts Number', 'et_builder' ),
'type' => 'text',
'option_category' => 'configuration',
'description' => __( 'Control how many products are displayed.', 'et_builder' ),
),
'include_categories' => array(
'label' => __( 'Include Categories', 'et_builder' ),
'type' => 'basic_option',
'renderer' => 'et_builder_include_categories_shop_option',
'renderer_options' => array(
'use_terms' => true,
'term_name' => 'product_cat',
),
'depends_show_if' => 'product_category',
'description' => __( 'Choose which categories you would like to include.', 'et_builder' ),
),
'columns_number' => array(
'label' => __( 'Columns Number', 'et_builder' ),
'type' => 'select',
'option_category' => 'layout',
'options' => array(
'0' => __( 'default', 'et_builder' ),
'6' => sprintf( __( '%1$s Columns', 'et_builder' ), esc_html( '6' ) ),
'5' => sprintf( __( '%1$s Columns', 'et_builder' ), esc_html( '5' ) ),
'4' => sprintf( __( '%1$s Columns', 'et_builder' ), esc_html( '4' ) ),
'3' => sprintf( __( '%1$s Columns', 'et_builder' ), esc_html( '3' ) ),
'2' => sprintf( __( '%1$s Columns', 'et_builder' ), esc_html( '2' ) ),
'1' => __( '1 Column', 'et_builder' ),
),
'description' => __( 'Choose how many columns to display.', 'et_builder' ),
),
'orderby' => array(
'label' => __( 'Order By', 'et_builder' ),
'type' => 'select',
'option_category' => 'configuration',
'options' => array(
'menu_order' => __( 'Default Sorting', 'et_builder' ),
'popularity' => __( 'Sort By Popularity', 'et_builder' ),
'rating' => __( 'Sort By Rating', 'et_builder' ),
'date' => __( 'Sort By Date', 'et_builder' ),
'price' => __( 'Sort By Price: Low To High', 'et_builder' ),
'price-desc' => __( 'Sort By Price: High To Low', 'et_builder' ),
),
'description' => __( 'Choose how your products should be ordered.', 'et_builder' ),
),
'admin_label' => array(
'label' => __( 'Admin Label', 'et_builder' ),
'type' => 'text',
'description' => __( 'This will change the label of the module in the builder for easy identification.', 'et_builder' ),
),
'module_id' => array(
'label' => __( 'CSS ID', 'et_builder' ),
'type' => 'text',
'option_category' => 'configuration',
'description' => __( 'Enter an optional CSS ID to be used for this module. An ID can be used to create custom CSS styling, or to create links to particular sections of your page.', 'et_builder' ),
),
'module_class' => array(
'label' => __( 'CSS Class', 'et_builder' ),
'type' => 'text',
'option_category' => 'configuration',
'description' => __( 'Enter optional CSS classes to be used for this module. A CSS class can be used to create custom CSS styling. You can add multiple classes, separated with a space.', 'et_builder' ),
),
'sale_badge_color' => array(
'label' => __( 'Sale Badge Color', 'et_builder' ),
'type' => 'color',
'custom_color' => true,
'tab_slug' => 'advanced',
),
'icon_hover_color' => array(
'label' => __( 'Icon Hover Color', 'et_builder' ),
'type' => 'color',
'custom_color' => true,
'tab_slug' => 'advanced',
),
'hover_overlay_color' => array(
'label' => __( 'Hover Overlay Color', 'et_builder' ),
'type' => 'color-alpha',
'custom_color' => true,
'tab_slug' => 'advanced',
),
'hover_icon' => array(
'label' => __( 'Hover Icon Picker', 'et_builder' ),
'type' => 'text',
'option_category' => 'configuration',
'class' => array( 'et-pb-font-icon' ),
'renderer' => 'et_pb_get_font_icon_list',
'renderer_with_field' => true,
'tab_slug' => 'advanced',
),
);
return $fields;
}
function shortcode_callback( $atts, $content = null, $function_name ) {
$module_id = $this->shortcode_atts['module_id'];
$module_class = $this->shortcode_atts['module_class'];
$type = $this->shortcode_atts['type'];
$include_categories = $this->shortcode_atts['include_categories'];
$posts_number = $this->shortcode_atts['posts_number'];
$orderby = $this->shortcode_atts['orderby'];
$columns = $this->shortcode_atts['columns_number'];
$sale_badge_color = $this->shortcode_atts['sale_badge_color'];
$icon_hover_color = $this->shortcode_atts['icon_hover_color'];
$hover_overlay_color = $this->shortcode_atts['hover_overlay_color'];
$hover_icon = $this->shortcode_atts['hover_icon'];
$module_class = ET_Builder_Element::add_module_order_class( $module_class, $function_name );
if ( '' !== $sale_badge_color ) {
ET_Builder_Element::set_style( $function_name, array(
'selector' => '%%order_class%% span.onsale',
'declaration' => sprintf(
'background-color: %1$s !important;',
esc_html( $sale_badge_color )
),
) );
}
if ( '' !== $icon_hover_color ) {
ET_Builder_Element::set_style( $function_name, array(
'selector' => '%%order_class%% .et_overlay:before',
'declaration' => sprintf(
'color: %1$s !important;',
esc_html( $icon_hover_color )
),
) );
}
if ( '' !== $hover_overlay_color ) {
ET_Builder_Element::set_style( $function_name, array(
'selector' => '%%order_class%% .et_overlay',
'declaration' => sprintf(
'background-color: %1$s !important;
border-color: %1$s;',
esc_html( $hover_overlay_color )
),
) );
}
$data_icon = '' !== $hover_icon
? sprintf(
' data-icon="%1$s"',
esc_attr( et_pb_process_font_icon( $hover_icon ) )
)
: '';
$woocommerce_shortcodes_types = array(
'recent' => 'recent_products',
'featured' => 'featured_products',
'sale' => 'sale_products',
'best_selling' => 'best_selling_products',
'top_rated' => 'top_rated_products',
'product_category' => 'product_category',
);
/**
* Actually, orderby parameter used by WooCommerce shortcode is equal to orderby parameter used by WP_Query
* Hence customize WooCommerce' product query via modify_woocommerce_shortcode_products_query method
* @see http://docs.woothemes.com/document/woocommerce-shortcodes/#section-5
*/
$modify_woocommerce_query = in_array( $orderby, array( 'price', 'price-desc', 'rating', 'popularity' ) );
if ( $modify_woocommerce_query ) {
add_filter( 'woocommerce_shortcode_products_query', array( $this, 'modify_woocommerce_shortcode_products_query' ), 10, 2 );
}
$output = sprintf(
'
%1$s
',
do_shortcode(
sprintf( '[%1$s per_page="%2$s" orderby="%3$s" columns="%4$s" category="%5$s"]',
esc_html( $woocommerce_shortcodes_types[$type] ),
esc_attr( $posts_number ),
esc_attr( $orderby ),
esc_attr( $columns ),
esc_attr( $include_categories )
)
),
( '' !== $module_id ? sprintf( ' id="%1$s"', esc_attr( $module_id ) ) : '' ),
( '' !== $module_class ? sprintf( ' %1$s', esc_attr( $module_class ) ) : '' ),
'0' === $columns ? ' et_pb_shop_grid' : '',
$data_icon
);
/**
* Remove modify_woocommerce_shortcode_products_query method after being used
*/
if ( $modify_woocommerce_query ) {
remove_filter( 'woocommerce_shortcode_products_query', array( $this, 'modify_woocommerce_shortcode_products_query' ) );
if ( function_exists( 'WC' ) ) {
WC()->query->remove_ordering_args(); // remove args added by woocommerce to avoid errors in sql queries performed afterwards
}
}
return $output;
}
/**
* Modifying WooCommerce' product query filter based on $orderby value given
* @see WC_Query->get_catalog_ordering_args()
*/
function modify_woocommerce_shortcode_products_query( $args, $atts ) {
if ( function_exists( 'WC' ) ) {
// By default, all order is ASC except for price-desc
$order = 'price-desc' === $this->shortcode_atts['orderby'] ? 'DESC' : 'ASC';
// Supported orderby arguments (as defined by WC_Query->get_catalog_ordering_args() ): rand | date | price | popularity | rating | title
$orderby = in_array( $this->shortcode_atts['orderby'], array( 'price-desc' ) ) ? 'price' : $this->shortcode_atts['orderby'];
// Get arguments for the given non-native orderby
$query_args = WC()->query->get_catalog_ordering_args( $orderby, $order );
// Confirm that returned argument isn't empty then merge returned argument with default argument
if( is_array( $query_args ) && ! empty( $query_args ) ) {
$args = array_merge( $args, $query_args );
}
}
return $args;
}
}
new ET_Builder_Module_Shop;
class ET_Builder_Module_Countdown_Timer extends ET_Builder_Module {
function init() {
$this->name = __( 'Countdown Timer', 'et_builder' );
$this->slug = 'et_pb_countdown_timer';
$this->whitelisted_fields = array(
'title',
'date_time',
'background_layout',
'use_background_color',
'background_color',
'admin_label',
'module_id',
'module_class',
);
$this->fields_defaults = array(
'background_layout' => array( 'dark' ),
'use_background_color' => array( 'on' ),
'background_color' => array( et_builder_accent_color(), 'only_default_setting' ),
);
$this->main_css_element = '%%order_class%%.et_pb_countdown_timer';
$this->advanced_options = array(
'fonts' => array(
'header' => array(
'label' => __( 'Header', 'et_builder' ),
'css' => array(
'main' => "{$this->main_css_element} h4",
),
),
'numbers' => array(
'label' => __( 'Numbers', 'et_builder' ),
'css' => array(
'main' => "{$this->main_css_element} .section p",
),
'line_height' => array(
'range_settings' => array(
'min' => '1',
'max' => '100',
'step' => '1',
),
),
),
'label' => array(
'label' => __( 'Label', 'et_builder' ),
'css' => array(
'main' => "{$this->main_css_element} .section p.label",
),
'line_height' => array(
'range_settings' => array(
'min' => '1',
'max' => '100',
'step' => '1',
),
),
),
),
'background' => array(
'settings' => array(
'color' => 'alpha',
),
),
'custom_margin_padding' => array(
'css' => array(
'important' => 'all',
),
),
);
$this->custom_css_options = array(
'container' => array(
'label' => __( 'Container', 'et_builder' ),
'selector' => '.et_pb_countdown_timer_container',
),
'title' => array(
'label' => __( 'Title', 'et_builder' ),
'selector' => '.title',
),
'timer_section' => array(
'label' => __( 'Timer Section', 'et_builder' ),
'selector' => '.section',
),
);
}
function get_fields() {
$fields = array(
'title' => array(
'label' => __( 'Countdown Timer Title', 'et_builder' ),
'type' => 'text',
'option_category' => 'basic_option',
'description' => __( 'This is the title displayed for the countdown timer.', 'et_builder' ),
),
'date_time' => array(
'label' => __( 'Countdown To', 'et_builder' ),
'type' => 'date_picker',
'option_category' => 'basic_option',
'description' => sprintf( __( 'This is the date the countdown timer is counting down to. Your countdown timer is based on your timezone settings in your
WordPress General Settings', 'et_builder' ), esc_url( admin_url( 'options-general.php' ) ) ),
),
'background_layout' => array(
'label' => __( 'Text Color', 'et_builder' ),
'type' => 'select',
'option_category' => 'color_option',
'options' => array(
'light' => __( 'Dark', 'et_builder' ),
'dark' => __( 'Light', 'et_builder' ),
),
'description' => __( 'Here you can choose whether your text should be light or dark. If you are working with a dark background, then your text should be light. If your background is light, then your text should be set to dark.', 'et_builder' ),
),
'use_background_color' => array(
'label' => __( 'Use Background Color', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'color_option',
'options' => array(
'on' => __( 'Yes', 'et_builder' ),
'off' => __( 'No', 'et_builder' ),
),
'affects' => array(
'#et_pb_background_color',
),
'description' => __( 'Here you can choose whether background color setting below should be used or not.', 'et_builder' ),
),
'background_color' => array(
'label' => __( 'Background Color', 'et_builder' ),
'type' => 'color-alpha',
'depends_default' => true,
'description' => __( 'Here you can define a custom background color for your countdown timer.', 'et_builder' ),
),
'admin_label' => array(
'label' => __( 'Admin Label', 'et_builder' ),
'type' => 'text',
'description' => __( 'This will change the label of the module in the builder for easy identification.', 'et_builder' ),
),
'module_id' => array(
'label' => __( 'CSS ID', 'et_builder' ),
'type' => 'text',
'option_category' => 'configuration',
'description' => __( 'Enter an optional CSS ID to be used for this module. An ID can be used to create custom CSS styling, or to create links to particular sections of your page.', 'et_builder' ),
),
'module_class' => array(
'label' => __( 'CSS Class', 'et_builder' ),
'type' => 'text',
'option_category' => 'configuration',
'description' => __( 'Enter optional CSS classes to be used for this module. A CSS class can be used to create custom CSS styling. You can add multiple classes, separated with a space.', 'et_builder' ),
),
);
return $fields;
}
function shortcode_callback( $atts, $content = null, $function_name ) {
$module_id = $this->shortcode_atts['module_id'];
$module_class = $this->shortcode_atts['module_class'];
$title = $this->shortcode_atts['title'];
$date_time = $this->shortcode_atts['date_time'];
$background_layout = $this->shortcode_atts['background_layout'];
$background_color = $this->shortcode_atts['background_color'];
$use_background_color = $this->shortcode_atts['use_background_color'];
$module_class = ET_Builder_Element::add_module_order_class( $module_class, $function_name );
$module_id = '' !== $module_id ? sprintf( ' id="%s"', esc_attr( $module_id ) ) : '';
$module_class = '' !== $module_class ? sprintf( ' %s', esc_attr( $module_class ) ) : '';
$background_layout = sprintf( ' et_pb_bg_layout_%s', esc_attr( $background_layout ) );
$end_date = gmdate( 'M d, Y H:i:s', strtotime( $date_time ) );
$gmt_offset = get_option( 'gmt_offset' );
$gmt_divider = '-' === substr( $gmt_offset, 0, 1 ) ? '-' : '+';
$gmt_offset_hour = str_pad( abs( intval( $gmt_offset ) ), 2, "0", STR_PAD_LEFT );
$gmt_offset_minute = str_pad( ( ( abs( $gmt_offset ) * 100 ) % 100 ) * ( 60 / 100 ), 2, "0", STR_PAD_LEFT );
$gmt = "GMT{$gmt_divider}{$gmt_offset_hour}{$gmt_offset_minute}";
if ( '' !== $title ) {
$title = sprintf( '
%s
', esc_html( $title ) );
}
$background_color_style = '';
if ( ! empty( $background_color ) && 'on' == $use_background_color ) {
$background_color_style = sprintf( ' style="background-color: %1$s;"', esc_attr( $background_color ) );
}
$output = sprintf(
'
',
$module_id,
$background_layout,
$module_class,
$background_color_style,
esc_attr( strtotime( "{$end_date} {$gmt}" ) ),
$title,
esc_html__( 'Day(s)', 'et_builder' ),
esc_html__( 'Hour(s)', 'et_builder' ),
esc_attr__( 'Hrs', 'et_builder' ),
esc_html__( 'Minute(s)', 'et_builder' ),
esc_attr__( 'Min', 'et_builder' ),
esc_html__( 'Second(s)', 'et_builder' ),
esc_attr__( 'Sec', 'et_builder' )
);
return $output;
}
}
new ET_Builder_Module_Countdown_Timer;
class ET_Builder_Module_Map extends ET_Builder_Module {
function init() {
$this->name = __( 'Map', 'et_builder' );
$this->slug = 'et_pb_map';
$this->child_slug = 'et_pb_map_pin';
$this->child_item_text = __( 'Pin', 'et_builder' );
$this->whitelisted_fields = array(
'address',
'zoom_level',
'address_lat',
'address_lng',
'map_center_map',
'mouse_wheel',
'admin_label',
'module_id',
'module_class',
'use_grayscale_filter',
'grayscale_filter_amount',
);
$this->fields_defaults = array(
'zoom_level' => array( '18', 'only_default_setting' ),
'mouse_wheel' => array( 'on' ),
'use_grayscale_filter' => array( 'off' ),
);
}
function get_fields() {
$fields = array(
'address' => array(
'label' => __( 'Map Center Address', 'et_builder' ),
'type' => 'text',
'option_category' => 'basic_option',
'additional_button' => sprintf(
'
%1$s',
esc_html__( 'Find', 'et_builder' )
),
'class' => array( 'et_pb_address' ),
'description' => __( 'Enter an address for the map center point, and the address will be geocoded and displayed on the map below.', 'et_builder' ),
),
'zoom_level' => array(
'type' => 'hidden',
'class' => array( 'et_pb_zoom_level' ),
),
'address_lat' => array(
'type' => 'hidden',
'class' => array( 'et_pb_address_lat' ),
),
'address_lng' => array(
'type' => 'hidden',
'class' => array( 'et_pb_address_lng' ),
),
'map_center_map' => array(
'renderer' => 'et_builder_generate_center_map_setting',
'use_container_wrapper' => false,
'option_category' => 'basic_option',
),
'mouse_wheel' => array(
'label' => __( 'Mouse Wheel Zoom', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'options' => array(
'on' => __( 'On', 'et_builder' ),
'off' => __( 'Off', 'et_builder' ),
),
'description' => __( 'Here you can choose whether the zoom level will be controlled by mouse wheel or not.', 'et_builder' ),
),
'admin_label' => array(
'label' => __( 'Admin Label', 'et_builder' ),
'type' => 'text',
'description' => __( 'This will change the label of the module in the builder for easy identification.', 'et_builder' ),
),
'module_id' => array(
'label' => __( 'CSS ID', 'et_builder' ),
'type' => 'text',
'option_category' => 'configuration',
'description' => __( 'Enter an optional CSS ID to be used for this module. An ID can be used to create custom CSS styling, or to create links to particular sections of your page.', 'et_builder' ),
),
'module_class' => array(
'label' => __( 'CSS Class', 'et_builder' ),
'type' => 'text',
'option_category' => 'configuration',
'description' => __( 'Enter optional CSS classes to be used for this module. A CSS class can be used to create custom CSS styling. You can add multiple classes, separated with a space.', 'et_builder' ),
),
'use_grayscale_filter' => array(
'label' => __( 'Use Grayscale Filter', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'options' => array(
'off' => __( 'No', 'et_builder' ),
'on' => __( 'Yes', 'et_builder' ),
),
'affects' => array(
'#et_pb_grayscale_filter_amount',
),
'tab_slug' => 'advanced',
),
'grayscale_filter_amount' => array(
'label' => __( 'Grayscale Filter Amount (%)', 'et_builder' ),
'type' => 'range',
'option_category' => 'configuration',
'tab_slug' => 'advanced',
),
);
return $fields;
}
function shortcode_callback( $atts, $content = null, $function_name ) {
$module_id = $this->shortcode_atts['module_id'];
$module_class = $this->shortcode_atts['module_class'];
$address_lat = $this->shortcode_atts['address_lat'];
$address_lng = $this->shortcode_atts['address_lng'];
$zoom_level = $this->shortcode_atts['zoom_level'];
$mouse_wheel = $this->shortcode_atts['mouse_wheel'];
$use_grayscale_filter = $this->shortcode_atts['use_grayscale_filter'];
$grayscale_filter_amount = $this->shortcode_atts['grayscale_filter_amount'];
wp_enqueue_script( 'google-maps-api' );
$module_class = ET_Builder_Element::add_module_order_class( $module_class, $function_name );
$all_pins_content = $this->shortcode_content;
$grayscale_filter_data = '';
if ( 'on' === $use_grayscale_filter && '' !== $grayscale_filter_amount ) {
$grayscale_filter_data = sprintf( ' data-grayscale="%1$s"', esc_attr( $grayscale_filter_amount ) );
}
$output = sprintf(
'
',
esc_attr( $address_lat ),
esc_attr( $address_lng ),
esc_attr( $zoom_level ),
$all_pins_content,
( '' !== $module_id ? sprintf( ' id="%1$s"', esc_attr( $module_id ) ) : '' ),
( '' !== $module_class ? sprintf( ' %1$s', esc_attr( $module_class ) ) : '' ),
esc_attr( $mouse_wheel ),
$grayscale_filter_data
);
return $output;
}
}
new ET_Builder_Module_Map;
class ET_Builder_Module_Map_Item extends ET_Builder_Module {
function init() {
$this->name = __( 'Pin', 'et_builder' );
$this->slug = 'et_pb_map_pin';
$this->type = 'child';
$this->child_title_var = 'title';
$this->whitelisted_fields = array(
'title',
'pin_address',
'zoom_level',
'pin_address_lat',
'pin_address_lng',
'map_center_map',
'content_new',
);
$this->advanced_setting_title_text = __( 'New Pin', 'et_builder' );
$this->settings_text = __( 'Pin Settings', 'et_builder' );
}
function get_fields() {
$fields = array(
'title' => array(
'label' => __( 'Title', 'et_builder' ),
'type' => 'text',
'option_category' => 'basic_option',
'description' => __( 'The title will be used within the tab button for this tab.', 'et_builder' ),
),
'pin_address' => array(
'label' => __( 'Map Pin Address', 'et_builder' ),
'type' => 'text',
'option_category' => 'basic_option',
'class' => array( 'et_pb_pin_address' ),
'description' => __( 'Enter an address for this map pin, and the address will be geocoded and displayed on the map below.', 'et_builder' ),
'additional_button' => sprintf(
'
%1$s',
esc_html__( 'Find', 'et_builder' )
),
),
'zoom_level' => array(
'renderer' => 'et_builder_generate_pin_zoom_level_input',
'option_category' => 'basic_option',
'class' => array( 'et_pb_zoom_level' ),
),
'pin_address_lat' => array(
'type' => 'hidden',
'class' => array( 'et_pb_pin_address_lat' ),
),
'pin_address_lng' => array(
'type' => 'hidden',
'class' => array( 'et_pb_pin_address_lng' ),
),
'map_center_map' => array(
'renderer' => 'et_builder_generate_center_map_setting',
'option_category' => 'basic_option',
'use_container_wrapper' => false,
),
'content_new' => array(
'label' => __( 'Content', 'et_builder' ),
'type' => 'tiny_mce',
'option_category' => 'basic_option',
'description' => __( 'Here you can define the content that will be placed within the infobox for the pin.', 'et_builder' ),
),
);
return $fields;
}
function shortcode_callback( $atts, $content = null, $function_name ) {
global $et_pb_tab_titles;
$title = $this->shortcode_atts['title'];
$pin_address_lat = $this->shortcode_atts['pin_address_lat'];
$pin_address_lng = $this->shortcode_atts['pin_address_lng'];
$replace_htmlentities = array( '”' => '', '″' => '' );
if ( ! empty( $pin_address_lat ) ) {
$pin_address_lat = strtr( $pin_address_lat, $replace_htmlentities );
}
if ( ! empty( $pin_address_lng ) ) {
$pin_address_lng = strtr( $pin_address_lng, $replace_htmlentities );
}
$content = $this->shortcode_content;
$output = sprintf(
'
%4$s
',
esc_attr( $pin_address_lat ),
esc_attr( $pin_address_lng ),
esc_html( $title ),
( '' != $content ? sprintf( '
%1$s
', $content ) : '' )
);
return $output;
}
}
new ET_Builder_Module_Map_Item;
class ET_Builder_Module_Social_Media_Follow extends ET_Builder_Module {
function init() {
$this->name = __( 'Social Media Follow', 'et_builder' );
$this->slug = 'et_pb_social_media_follow';
$this->child_slug = 'et_pb_social_media_follow_network';
$this->child_item_text = __( 'Social Network', 'et_builder' );
$this->whitelisted_fields = array(
'link_shape',
'background_layout',
'url_new_window',
'follow_button',
'admin_label',
'module_id',
'module_class',
);
$this->fields_defaults = array(
'link_shape' => array( 'rounded_rectangle' ),
'background_layout' => array( 'light' ),
'url_new_window' => array( 'on' ),
'follow_button' => array( 'off' ),
);
$this->custom_css_options = array(
'social_follow' => array(
'label' => __( 'Social Follow', 'et_builder' ),
'selector' => 'li',
),
'social_icon' => array(
'label' => __( 'Social Icon', 'et_builder' ),
'selector' => 'li a.icon',
),
);
}
function get_fields() {
$fields = array(
'link_shape' => array(
'label' => __( 'Link Shape', 'et_builder' ),
'type' => 'select',
'option_category' => 'layout',
'options' => array(
'rounded_rectangle' => __( 'Rounded Rectangle', 'et_builder' ),
'circle' => __( 'Circle', 'et_builder' ),
),
'description' => __( 'Here you can choose the shape of your social network icons.', 'et_builder' ),
),
'background_layout' => array(
'label' => __( 'Text Color', 'et_builder' ),
'type' => 'select',
'option_category' => 'color_option',
'options' => array(
'light' => __( 'Dark', 'et_builder' ),
'dark' => __( 'Light', 'et_builder' ),
),
'description' => __( 'Here you can choose whether your text should be light or dark. If you are working with a dark background, then your text should be light. If your background is light, then your text should be set to dark.', 'et_builder' ),
),
'url_new_window' => array(
'label' => __( 'Url Opens', 'et_builder' ),
'type' => 'select',
'option_category' => 'configuration',
'options' => array(
'off' => __( 'In The Same Window', 'et_builder' ),
'on' => __( 'In The New Tab', 'et_builder' ),
),
'description' => __( 'Here you can choose whether or not your link opens in a new window', 'et_builder' ),
),
'follow_button' => array(
'label' => __( 'Follow Button', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'options' => array(
'off' => __( 'Off', 'et_builder' ),
'on' => __( 'On', 'et_builder' ),
),
'description' => __( 'Here you can choose whether or not to include the follow button next to the icon.', 'et_builder' ),
),
'admin_label' => array(
'label' => __( 'Admin Label', 'et_builder' ),
'type' => 'text',
'description' => __( 'This will change the label of the module in the builder for easy identification.', 'et_builder' ),
),
'module_id' => array(
'label' => __( 'CSS ID', 'et_builder' ),
'type' => 'text',
'option_category' => 'configuration',
'description' => __( 'Enter an optional CSS ID to be used for this module. An ID can be used to create custom CSS styling, or to create links to particular sections of your page.', 'et_builder' ),
),
'module_class' => array(
'label' => __( 'CSS Class', 'et_builder' ),
'type' => 'text',
'option_category' => 'configuration',
'description' => __( 'Enter optional CSS classes to be used for this module. A CSS class can be used to create custom CSS styling. You can add multiple classes, separated with a space.', 'et_builder' ),
),
);
return $fields;
}
function pre_shortcode_content() {
global $et_pb_social_media_follow_link;
$link_shape = $this->shortcode_atts['link_shape'];
$url_new_window = $this->shortcode_atts['url_new_window'];
$follow_button = $this->shortcode_atts['follow_button'];
$et_pb_social_media_follow_link = array(
'url_new_window' => $url_new_window,
'shape' => $link_shape,
'follow_button' => $follow_button,
);
}
function shortcode_callback( $atts, $content = null, $function_name ) {
global $et_pb_social_media_follow_link;
$module_id = $this->shortcode_atts['module_id'];
$module_class = $this->shortcode_atts['module_class'];
$background_layout = $this->shortcode_atts['background_layout'];
$class = " et_pb_module et_pb_bg_layout_{$background_layout}";
$output = sprintf(
'
',
$this->shortcode_content,
esc_attr( $class ),
( '' !== $module_id ? sprintf( ' id="%1$s"', esc_attr( $module_id ) ) : '' ),
( '' !== $module_class ? sprintf( ' %1$s', esc_attr( $module_class ) ) : '' ),
( 'on' === $et_pb_social_media_follow_link['follow_button'] ? ' has_follow_button' : '' )
);
return $output;
}
}
new ET_Builder_Module_Social_Media_Follow;
class ET_Builder_Module_Social_Media_Follow_Item extends ET_Builder_Module {
function init() {
$this->name = __( 'Social Network', 'et_builder' );
$this->slug = 'et_pb_social_media_follow_network';
$this->type = 'child';
$this->child_title_var = 'content_new';
$this->whitelisted_fields = array(
'social_network',
'content_new',
'url',
'bg_color',
'skype_url',
'skype_action',
);
$this->fields_defaults = array(
'url' => array( '#' ),
'bg_color' => array( et_builder_accent_color(), 'only_default_setting' ),
'skype_action' => array( 'call' ),
);
$this->advanced_setting_title_text = __( 'New Social Network', 'et_builder' );
$this->settings_text = __( 'Social Network Settings', 'et_builder' );
}
function get_fields() {
$fields = array(
'social_network' => array(
'label' => __( 'Social Network', 'et_builder' ),
'type' => 'select',
'option_category' => 'basic_option',
'class' => 'et-pb-social-network',
'options' => array(
'' => __( 'Select a Network', 'et_builder' ),
'facebook' => array(
'value' => __( 'facebook', 'et_builder' ),
'data' => array( 'color' => '#3b5998' ),
),
'twitter' => array(
'value' => __( 'Twitter', 'et_builder' ),
'data' => array( 'color' => '#00aced' ),
),
'google-plus' => array(
'value' => __( 'Google+', 'et_builder' ),
'data' => array( 'color' => '#dd4b39' ),
),
'pinterest' => array(
'value' => __( 'Pinterest', 'et_builder' ),
'data' => array( 'color' => '#cb2027' ),
),
'linkedin' => array(
'value' => __( 'LinkedIn', 'et_builder' ),
'data' => array( 'color' => '#007bb6' ),
),
'tumblr' => array(
'value' => __( 'tumblr', 'et_builder' ),
'data' => array( 'color' => '#32506d' ),
),
'instagram' => array(
'value' => __( 'Instagram', 'et_builder' ),
'data' => array( 'color' => '#517fa4' ),
),
'skype' => array(
'value' => __( 'skype', 'et_builder' ),
'data' => array( 'color' => '#12A5F4' ),
),
'flikr' => array(
'value' => __( 'flikr', 'et_builder' ),
'data' => array( 'color' => '#ff0084' ),
),
'myspace' => array(
'value' => __( 'MySpace', 'et_builder' ),
'data' => array( 'color' => '#3b5998' ),
),
'dribbble' => array(
'value' => __( 'dribbble', 'et_builder' ),
'data' => array( 'color' => '#ea4c8d' ),
),
'youtube' => array(
'value' => __( 'Youtube', 'et_builder' ),
'data' => array( 'color' => '#a82400' ),
),
'vimeo' => array(
'value' => __( 'Vimeo', 'et_builder' ),
'data' => array( 'color' => '#45bbff' ),
),
'rss' => array(
'value' => __( 'RSS', 'et_builder' ),
'data' => array( 'color' => '#ff8a3c' ),
),
),
'affects' => array(
'#et_pb_url',
'#et_pb_skype_url',
'#et_pb_skype_action',
),
'description' => __( 'Choose the social network', 'et_builder' ),
),
'content_new' => array(
'label' => __( 'Content', 'et_builder' ),
'type' => 'hidden',
),
'url' => array(
'label' => __( 'Account URL', 'et_builder' ),
'type' => 'text',
'option_category' => 'basic_option',
'description' => __( 'The URL for this social network link.', 'et_builder' ),
'depends_show_if_not' => 'skype',
),
'skype_url' => array(
'label' => __( 'Account Name', 'et_builder' ),
'type' => 'text',
'option_category' => 'basic_option',
'description' => __( 'The Skype account name.', 'et_builder' ),
'depends_show_if' => 'skype',
),
'skype_action' => array(
'label' => __( 'Skype Button Action', 'et_builder' ),
'type' => 'select',
'option_category' => 'basic_option',
'options' => array(
'call' => __( 'Call', 'et_builder' ),
'chat' => __( 'Chat', 'et_builder' ),
),
'depends_show_if' => 'skype',
'description' => __( 'Here you can choose which action to execute on button click', 'et_builder' ),
),
'bg_color' => array(
'label' => __( 'Icon Color', 'et_builder' ),
'type' => 'color-alpha',
'description' => __( 'This will change the icon color.', 'et_builder' ),
'additional_code' => '
',
),
);
return $fields;
}
function shortcode_callback( $atts, $content = null, $function_name ) {
global $et_pb_social_media_follow_link;
$social_network = $this->shortcode_atts['social_network'];
$url = $this->shortcode_atts['url'];
$bg_color = $this->shortcode_atts['bg_color'];
$skype_url = $this->shortcode_atts['skype_url'];
$skype_action = $this->shortcode_atts['skype_action'];
$follow_button = '';
if ( isset( $bg_color ) && '' !== $bg_color ) {
$bg_color_style = sprintf( 'background-color: %1$s;', esc_attr( $bg_color ) );
}
if ( 'skype' === $social_network ) {
$skype_url = sprintf(
'skype:%1$s?%2$s',
sanitize_text_field( $skype_url ),
sanitize_text_field( $skype_action )
);
}
if ( 'on' === $et_pb_social_media_follow_link['follow_button'] ) {
$follow_button = sprintf(
'
%4$s',
'skype' !== $social_network ? esc_url( $url ) : $skype_url,
esc_attr( $content ),
( 'on' === $et_pb_social_media_follow_link['url_new_window'] ? ' target="_blank"' : '' ),
esc_html__( 'Follow', 'et_builder' )
);
}
$output = sprintf(
'
%6$s
%8$s
',
( '' !== $social_network ? sprintf( ' et-social-%s', esc_attr( $social_network ) ) : '' ),
( '' !== $et_pb_social_media_follow_link['shape'] ? sprintf( ' %s', esc_attr( $et_pb_social_media_follow_link['shape'] ) ) : '' ),
$bg_color_style,
'skype' !== $social_network ? esc_url( $url ) : $skype_url,
esc_attr( $content ),
sanitize_text_field( $content ),
( 'on' === $et_pb_social_media_follow_link['url_new_window'] ? ' target="_blank"' : '' ),
$follow_button
);
return $output;
}
}
new ET_Builder_Module_Social_Media_Follow_Item;
class ET_Builder_Module_Post_Title extends ET_Builder_Module {
function init() {
$this->name = __( 'Post Title', 'et_builder' );
$this->slug = 'et_pb_post_title';
$this->defaults = array();
$this->whitelisted_fields = array(
'title',
'meta',
'author',
'date',
'date_format',
'categories',
'comments',
'featured_image',
'featured_placement',
'parallax_effect',
'parallax_method',
'text_orientation',
'text_color',
'text_background',
'text_bg_color',
'module_bg_color',
'admin_label',
'module_id',
'module_class',
);
$this->fields_defaults = array(
'title' => array( 'on' ),
'meta' => array( 'on' ),
'author' => array( 'on' ),
'date' => array( 'on' ),
'date_format' => array( 'M j, Y' ),
'categories' => array( 'on' ),
'comments' => array( 'on' ),
'featured_image' => array( 'on' ),
'featured_placement' => array( 'below' ),
'parallax_effect' => array( 'off' ),
'parallax_method' => array( 'on' ),
'text_orientation' => array( 'left' ),
'text_color' => array( 'dark' ),
'text_background' => array( 'off' ),
'text_bg_color' => array( 'rgba(255,255,255,0.9)', 'only_default_setting' ),
);
$this->main_css_element = '%%order_class%%';
$this->advanced_options = array(
'border' => array(
'css' => array(
'main' => "{$this->main_css_element}.et_pb_featured_bg, {$this->main_css_element}",
),
),
'custom_margin_padding' => array(
'css' => array(
'main' => ".et_pb_section {$this->main_css_element}.et_pb_post_title",
'important' => 'all',
),
),
'fonts' => array(
'title' => array(
'label' => __( 'Title', 'et_builder' ),
'use_all_caps' => true,
'css' => array(
'main' => "{$this->main_css_element} .et_pb_title_container h1",
),
),
'meta' => array(
'label' => __( 'Meta', 'et_builder' ),
'css' => array(
'main' => "{$this->main_css_element} .et_pb_title_container .et_pb_title_meta_container, {$this->main_css_element} .et_pb_title_container .et_pb_title_meta_container a",
),
),
),
);
}
function get_fields() {
$fields = array(
'title' => array(
'label' => __( 'Show Title', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'options' => array(
'on' => __( 'Yes', 'et_builder' ),
'off' => __( 'No', 'et_builder' ),
),
'description' => __( 'Here you can choose whether or not display the Post Title', 'et_builder' ),
),
'meta' => array(
'label' => __( 'Show Meta', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'options' => array(
'on' => __( 'Yes', 'et_builder' ),
'off' => __( 'No', 'et_builder' ),
),
'affects' => array(
'#et_pb_author',
'#et_pb_date',
'#et_pb_categories',
'#et_pb_comments',
),
'description' => __( 'Here you can choose whether or not display the Post Meta', 'et_builder' ),
),
'author' => array(
'label' => __( 'Show Author', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'options' => array(
'on' => __( 'Yes', 'et_builder' ),
'off' => __( 'No', 'et_builder' ),
),
'depends_show_if' => 'on',
'description' => __( 'Here you can choose whether or not display the Author Name in Post Meta', 'et_builder' ),
),
'date' => array(
'label' => __( 'Show Date', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'options' => array(
'on' => __( 'Yes', 'et_builder' ),
'off' => __( 'No', 'et_builder' ),
),
'depends_show_if' => 'on',
'affects' => array(
'#et_pb_date_format'
),
'description' => __( 'Here you can choose whether or not display the Date in Post Meta', 'et_builder' ),
),
'date_format' => array(
'label' => __( 'Date Format', 'et_builder' ),
'type' => 'text',
'option_category' => 'configuration',
'depends_show_if' => 'on',
'description' => __( 'Here you can define the Date Format in Post Meta. Default is \'M j, Y\'', 'et_builder' ),
),
'categories' => array(
'label' => __( 'Show Post Categories', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'options' => array(
'on' => __( 'Yes', 'et_builder' ),
'off' => __( 'No', 'et_builder' ),
),
'depends_show_if' => 'on',
'description' => __( 'Here you can choose whether or not display the Categories in Post Meta. Note: This option doesn\'t work with custom post types.', 'et_builder' ),
),
'comments' => array(
'label' => __( 'Show Comments Count', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'options' => array(
'on' => __( 'Yes', 'et_builder' ),
'off' => __( 'No', 'et_builder' ),
),
'depends_show_if' => 'on',
'description' => __( 'Here you can choose whether or not display the Comments Count in Post Meta.', 'et_builder' ),
),
'featured_image' => array(
'label' => __( 'Show Featured Image', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'options' => array(
'on' => __( 'Yes', 'et_builder' ),
'off' => __( 'No', 'et_builder' ),
),
'affects' => array(
'#et_pb_featured_placement',
),
'description' => __( 'Here you can choose whether or not display the Featured Image', 'et_builder' ),
),
'featured_placement' => array(
'label' => __( 'Featured Image Placement', 'et_builder' ),
'type' => 'select',
'option_category' => 'configuration',
'options' => array(
'below' => __( 'Below Title', 'et_builder' ),
'above' => __( 'Above Title', 'et_builder' ),
'background' => __( 'Title/Meta Background Image', 'et_builder' ),
),
'depends_show_if' => 'on',
'affects' => array(
'#et_pb_parallax_effect',
),
'description' => __( 'Here you can choose where to place the Featured Image', 'et_builder' ),
),
'parallax_effect' => array(
'label' => __( 'Use Parallax Effect', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'options' => array(
'on' => __( 'Yes', 'et_builder' ),
'off' => __( 'No', 'et_builder' ),
),
'depends_show_if' => 'background',
'affects' => array(
'#et_pb_parallax_method',
),
'description' => __( 'Here you can choose whether or not use parallax effect for the featured image', 'et_builder' ),
),
'parallax_method' => array(
'label' => __( 'Parallax Method', 'et_builder' ),
'type' => 'select',
'option_category' => 'configuration',
'options' => array(
'on' => __( 'CSS', 'et_builder' ),
'off' => __( 'True Parallax', 'et_builder' ),
),
'depends_show_if' => 'on',
'description' => __( 'Here you can choose which parallax method to use for the featured image', 'et_builder' ),
),
'text_orientation' => array(
'label' => __( 'Text Orientation', 'et_builder' ),
'type' => 'select',
'option_category' => 'layout',
'options' => array(
'left' => __( 'Left', 'et_builder' ),
'center' => __( 'Center', 'et_builder' ),
'right' => __( 'Right', 'et_builder' ),
),
'description' => __( 'Here you can choose the orientation for the Title/Meta text', 'et_builder' ),
),
'text_color' => array(
'label' => __( 'Text Color', 'et_builder' ),
'type' => 'select',
'option_category' => 'color_option',
'options' => array(
'dark' => __( 'Dark', 'et_builder' ),
'light' => __( 'Light', 'et_builder' ),
),
'description' => __( 'Here you can choose the color for the Title/Meta text', 'et_builder' ),
),
'text_background' => array(
'label' => __( 'Use Text Background Color', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'color_option',
'options' => array(
'off' => __( 'No', 'et_builder' ),
'on' => __( 'Yes', 'et_builder' ),
),
'affects' => array(
'#et_pb_text_bg_color',
),
'description' => __( 'Here you can choose whether or not use the background color for the Title/Meta text', 'et_builder' ),
),
'text_bg_color' => array(
'label' => __( 'Text Background Color', 'et_builder' ),
'type' => 'color-alpha',
'depends_show_if' => 'on',
),
'module_bg_color' => array(
'label' => __( 'Background Color', 'et_builder' ),
'type' => 'color-alpha',
'custom_color' => true,
'tab_slug' => 'advanced',
),
'admin_label' => array(
'label' => __( 'Admin Label', 'et_builder' ),
'type' => 'text',
'description' => __( 'This will change the label of the module in the builder for easy identification.', 'et_builder' ),
),
'module_id' => array(
'label' => __( 'CSS ID', 'et_builder' ),
'type' => 'text',
'option_category' => 'configuration',
'description' => __( 'Enter an optional CSS ID to be used for this module. An ID can be used to create custom CSS styling, or to create links to particular sections of your page.', 'et_builder' ),
),
'module_class' => array(
'label' => __( 'CSS Class', 'et_builder' ),
'type' => 'text',
'option_category' => 'configuration',
'description' => __( 'Enter optional CSS classes to be used for this module. A CSS class can be used to create custom CSS styling. You can add multiple classes, separated with a space.', 'et_builder' ),
),
);
return $fields;
}
function shortcode_callback( $atts, $content = null, $function_name ) {
$module_id = $this->shortcode_atts['module_id'];
$module_class = $this->shortcode_atts['module_class'];
$title = $this->shortcode_atts['title'];
$meta = $this->shortcode_atts['meta'];
$author = $this->shortcode_atts['author'];
$date = $this->shortcode_atts['date'];
$date_format = $this->shortcode_atts['date_format'];
$categories = $this->shortcode_atts['categories'];
$comments = $this->shortcode_atts['comments'];
$featured_image = $this->shortcode_atts['featured_image'];
$featured_placement = $this->shortcode_atts['featured_placement'];
$parallax_effect = $this->shortcode_atts['parallax_effect'];
$parallax_method = $this->shortcode_atts['parallax_method'];
$text_orientation = $this->shortcode_atts['text_orientation'];
$text_color = $this->shortcode_atts['text_color'];
$text_background = $this->shortcode_atts['text_background'];
$text_bg_color = $this->shortcode_atts['text_bg_color'];
$module_bg_color = $this->shortcode_atts['module_bg_color'];
// display the shortcode only on singlular pages
if ( ! is_singular() ) {
return;
}
$module_class = ET_Builder_Element::add_module_order_class( $module_class, $function_name );
$this->process_additional_options( $function_name );
$output = '';
$featured_image_output = '';
$parallax_background_contaier = '';
if ( 'on' === $featured_image && ( 'above' === $featured_placement || 'below' === $featured_placement ) ) {
$featured_image_output = sprintf( '
%1$s
',
get_the_post_thumbnail( get_the_ID(), 'large' )
);
}
if ( 'on' === $title ) {
if ( is_et_pb_preview() && isset( $_POST['post_title'] ) && wp_verify_nonce( $_POST['et_pb_preview_nonce'], 'et_pb_preview_nonce' ) ) {
$post_title = sanitize_text_field( wp_unslash( $_POST['post_title'] ) );
} else {
$post_title = get_the_title();
}
$output .= sprintf( '
%s
',
$post_title
);
}
if ( 'on' === $meta ) {
$meta_array = array();
foreach( array( 'author', 'date', 'categories', 'comments' ) as $single_meta ) {
if ( 'on' === $$single_meta && ( 'categories' !== $single_meta || ( 'categories' === $single_meta && is_singular( 'post' ) ) ) ) {
$meta_array[] = $single_meta;
}
}
$output .= sprintf( '
%1$s
',
et_pb_postinfo_meta( $meta_array, $date_format, esc_html__( '0 comments', 'et_builder' ), esc_html__( '1 comment', 'et_builder' ), '% ' . esc_html__( 'comments', 'et_builder' ) )
);
}
if ( 'on' === $featured_image && 'background' === $featured_placement ) {
$featured_image_src = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), 'full' );
ET_Builder_Element::set_style( $function_name, array(
'selector' => sprintf(
'%%order_class%% %1$s',
( 'on' === $parallax_effect ? '.et_parallax_bg' : '' )
),
'declaration' => sprintf(
'background-image: url("%1$s");',
esc_url( $featured_image_src[0] )
),
) );
if ( 'on' === $parallax_effect ) {
$parallax_background_contaier = sprintf( '
',
'on' === $parallax_method ? ' et_pb_parallax_css' : ''
);
}
}
if ( 'on' === $text_background ) {
ET_Builder_Element::set_style( $function_name, array(
'selector' => '%%order_class%% .et_pb_title_container',
'declaration' => sprintf(
'background-color: %1$s; padding: 1em 1.5em;',
esc_html( $text_bg_color )
),
) );
}
ET_Builder_Element::set_style( $function_name, array(
'selector' => '%%order_class%%',
'declaration' => sprintf(
'text-align: %1$s;',
esc_html( $text_orientation )
),
) );
$background_layout = 'dark' === $text_color ? 'light' : 'dark';
$module_class .= ' et_pb_bg_layout_' . $background_layout;
ET_Builder_Element::set_style( $function_name, array(
'selector' => '%%order_class%%',
'declaration' => sprintf(
'background-color: %1$s;',
esc_html( $module_bg_color )
),
) );
$output = sprintf(
'
',
$output,
( '' !== $module_class ? sprintf( ' %1$s', esc_attr( $module_class ) ) : '' ),
( '' !== $module_id ? sprintf( ' id="%1$s"', esc_attr( $module_id ) ) : '' ),
'on' === $featured_image && 'background' === $featured_placement ? ' et_pb_featured_bg' : '',
$parallax_background_contaier,
'on' === $featured_image && 'above' === $featured_placement ? $featured_image_output : '',
'on' === $featured_image && 'below' === $featured_placement ? $featured_image_output : ''
);
return $output;
}
}
new ET_Builder_Module_Post_Title;
class ET_Builder_Module_Fullwidth_Header extends ET_Builder_Module {
function init() {
$this->name = __( 'Fullwidth Header', 'et_builder' );
$this->slug = 'et_pb_fullwidth_header';
$this->fullwidth = true;
$this->main_css_element = '%%order_class%%';
$this->whitelisted_fields = array(
'title',
'subhead',
'background_layout',
'text_orientation',
'header_fullscreen',
'header_scroll_down',
'scroll_down_icon',
'scroll_down_icon_color',
'scroll_down_icon_size',
'title_font',
'title_font_color',
'title_font_size',
'subhead_font',
'subhead_font_color',
'subhead_font_size',
'content_font',
'content_font_color',
'content_font_size',
'max_width',
'button_one_text',
'button_one_url',
'button_two_text',
'button_two_url',
'background_url',
'background_color',
'background_overlay_color',
'parallax',
'parallax_method',
'logo_image_url',
'logo_title',
'logo_alt_text',
'content_orientation',
'header_image_url',
'image_orientation',
'content_new',
'admin_label',
'module_id',
'module_class',
);
$this->fields_defaults = array(
'background_layout' => array( 'light' ),
'text_orientation' => array( 'left' ),
'header_fullscreen' => array( 'off' ),
'header_scroll_down' => array( 'off' ),
'scroll_down_icon' => array( '%%3%%', 'add_default_setting' ),
'parallax' => array( 'off' ),
'parallax_method' => array( 'off' ),
'content_orientation' => array( 'center' ),
'image_orientation' => array( 'center' ),
);
$this->options_toggles = array(
'advanced' => array(
'settings' => array(
'toggles_disabled' => true,
),
'toggles' => array(
'title_styles' => __( 'Title Styling', 'et_builder' ),
'subhead_styles' => __( 'Subhead Styling', 'et_builder' ),
'content_styles' => __( 'Content Styling', 'et_builder' ),
),
),
);
$this->advanced_options = array(
'button' => array(
'button_one' => array(
'label' => __( 'Button One', 'et_builder' ),
'css' => array(
'main' => "{$this->main_css_element} .et_pb_button_one.et_pb_button",
),
),
'button_two' => array(
'label' => __( 'Button Two', 'et_builder' ),
'css' => array(
'main' => "{$this->main_css_element} .et_pb_button_two.et_pb_button",
),
),
),
);
$this->custom_css_options = array(
'header_container' => array(
'label' => __( 'Header Container', 'et_builder' ),
'selector' => '.et_pb_fullwidth_header_container',
),
);
}
function get_fields() {
$fields = array(
'title' => array(
'label' => __( 'Title', 'et_builder' ),
'type' => 'text',
'option_category' => 'basic_option',
'description' => __( 'Enter your page title here.', 'et_builder' ),
),
'subhead' => array(
'label' => __( 'Subheading Text', 'et_builder' ),
'type' => 'text',
'option_category' => 'basic_option',
'description' => __( 'If you would like to use a subhead, add it here. Your subhead will appear below your title in a small font.', 'et_builder' ),
),
'background_layout' => array(
'label' => __( 'Text Color', 'et_builder' ),
'type' => 'select',
'option_category' => 'color_option',
'options' => array(
'light' => __( 'Dark', 'et_builder' ),
'dark' => __( 'Light', 'et_builder' ),
),
'description' => __( 'Here you can choose the value of your text. If you are working with a dark background, then your text should be set to light. If you are working with a light background, then your text should be dark.', 'et_builder' ),
),
'text_orientation' => array(
'label' => __( 'Text & Logo Orientation', 'et_builder' ),
'type' => 'select',
'option_category' => 'layout',
'options' => et_builder_get_text_orientation_options(),
'description' => __( 'This controls the how your text is aligned within the module.', 'et_builder' ),
),
'header_fullscreen' => array(
'label' => __( 'Make Fullscreen', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'options' => array(
'off' => __( 'No', 'et_builder' ),
'on' => __( 'Yes', 'et_builder' ),
),
'affects' => array(
'#et_pb_content_orientation',
),
'description' => __( 'Here you can choose whether the header is expanded to fullscreen size.', 'et_builder' ),
),
'header_scroll_down' => array(
'label' => __( 'Show Scroll Down Button', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'options' => array(
'off' => __( 'No', 'et_builder' ),
'on' => __( 'Yes', 'et_builder' ),
),
'affects' => array(
'#et_pb_scroll_down_icon',
),
'description' => __( 'Here you can choose whether the scroll down button is shown.', 'et_builder' ),
),
'scroll_down_icon' => array(
'label' => __( 'Icon', 'et_builder' ),
'type' => 'text',
'option_category' => 'configuration',
'class' => array( 'et-pb-font-icon' ),
'renderer' => 'et_pb_get_font_down_icon_list',
'renderer_with_field' => true,
'description' => __( 'Choose an icon to display for the scroll down button.', 'et_builder' ),
'depends_show_if' => 'on',
),
'scroll_down_icon_color' => array(
'label' => __( 'Scroll Down Icon Color', 'et_builder' ),
'type' => 'color-alpha',
'custom_color' => true,
'tab_slug' => 'advanced',
),
'scroll_down_icon_size' => array(
'label' => __( 'Scroll Down Icon Size', 'et_builder' ),
'type' => 'range',
'option_category' => 'layout',
'tab_slug' => 'advanced',
),
'title_font' => array(
'label' => __( 'Title Font', 'et_builder' ),
'type' => 'font',
'tab_slug' => 'advanced',
'toggle_slug' => 'title_styles',
),
'title_font_color' => array(
'label' => __( 'Title Font Color', 'et_builder' ),
'type' => 'color',
'custom_color' => true,
'tab_slug' => 'advanced',
'toggle_slug' => 'title_styles',
),
'title_font_size' => array(
'label' => __( 'Title Font Size', 'et_builder' ),
'type' => 'range',
'option_category' => 'font_option',
'tab_slug' => 'advanced',
'toggle_slug' => 'title_styles',
),
'subhead_font' => array(
'label' => __( 'Subhead Font', 'et_builder' ),
'type' => 'font',
'tab_slug' => 'advanced',
'toggle_slug' => 'subhead_styles',
),
'subhead_font_color' => array(
'label' => __( 'Subhead Font Color', 'et_builder' ),
'type' => 'color',
'custom_color' => true,
'tab_slug' => 'advanced',
'toggle_slug' => 'subhead_styles',
),
'subhead_font_size' => array(
'label' => __( 'Subhead Font Size', 'et_builder' ),
'type' => 'range',
'option_category' => 'font_option',
'tab_slug' => 'advanced',
'toggle_slug' => 'subhead_styles',
),
'content_font' => array(
'label' => __( 'Content Font', 'et_builder' ),
'type' => 'font',
'tab_slug' => 'advanced',
'toggle_slug' => 'content_styles',
),
'content_font_color' => array(
'label' => __( 'Content Font Color', 'et_builder' ),
'type' => 'color',
'custom_color' => true,
'tab_slug' => 'advanced',
'toggle_slug' => 'content_styles',
),
'content_font_size' => array(
'label' => __( 'Content Font Size', 'et_builder' ),
'type' => 'range',
'option_category' => 'font_option',
'tab_slug' => 'advanced',
'toggle_slug' => 'content_styles',
),
'max_width' => array(
'label' => __( 'Text Max Width', 'et_builder' ),
'type' => 'text',
'option_category' => 'layout',
'tab_slug' => 'advanced',
),
'button_one_text' => array(
'label' => sprintf( __( 'Button %1$s Text', 'et_builder' ), '#1' ),
'type' => 'text',
'option_category' => 'basic_option',
'description' => __( 'Enter the text for the Button.', 'et_builder' ),
),
'button_one_url' => array(
'label' => sprintf( __( 'Button %1$s URL', 'et_builder' ), '#1' ),
'type' => 'text',
'option_category' => 'basic_option',
'description' => __( 'Enter the URL for the Button.', 'et_builder' ),
),
'button_two_text' => array(
'label' => sprintf( __( 'Button %1$s Text', 'et_builder' ), '#2' ),
'type' => 'text',
'option_category' => 'basic_option',
'description' => __( 'Enter the text for the Button.', 'et_builder' ),
),
'button_two_url' => array(
'label' => sprintf( __( 'Button %1$s URL', 'et_builder' ), '#2' ),
'type' => 'text',
'option_category' => 'basic_option',
'description' => __( 'Enter the URL for the Button.', 'et_builder' ),
),
'background_url' => array(
'label' => __( 'Background Image URL', 'et_builder' ),
'type' => 'upload',
'option_category' => 'basic_option',
'upload_button_text' => __( 'Upload an image', 'et_builder' ),
'choose_text' => __( 'Choose an Image', 'et_builder' ),
'update_text' => __( 'Set As Image', 'et_builder' ),
'description' => __( 'Upload your desired image, or type in the URL to the image you would like to display.', 'et_builder' ),
),
'background_color' => array(
'label' => __( 'Background Color', 'et_builder' ),
'type' => 'color-alpha',
),
'background_overlay_color' => array(
'label' => __( 'Background Overlay Color', 'et_builder' ),
'type' => 'color-alpha',
),
'parallax' => array(
'label' => __( 'Use Parallax effect', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'options' => array(
'off' => __( 'No', 'et_builder' ),
'on' => __( 'Yes', 'et_builder' ),
),
'affects' => array(
'#et_pb_parallax_method',
),
'description' => __( 'If enabled, your background images will have a fixed position as your scroll, creating a fun parallax-like effect.', 'et_builder' ),
),
'parallax_method' => array(
'label' => __( 'Parallax method', 'et_builder' ),
'type' => 'select',
'option_category' => 'configuration',
'options' => array(
'off' => __( 'CSS', 'et_builder' ),
'on' => __( 'True Parallax', 'et_builder' ),
),
'depends_show_if' => 'on',
'description' => __( 'Define the method, used for the parallax effect.', 'et_builder' ),
),
'logo_image_url' => array(
'label' => __( 'Logo Image URL', 'et_builder' ),
'type' => 'upload',
'option_category' => 'basic_option',
'upload_button_text' => __( 'Upload an image', 'et_builder' ),
'choose_text' => __( 'Choose an Image', 'et_builder' ),
'update_text' => __( 'Set As Image', 'et_builder' ),
'description' => __( 'Upload your desired image, or type in the URL to the image you would like to display.', 'et_builder' ),
),
'logo_alt_text' => array(
'label' => __( 'Logo Image Alternative Text', 'et_builder' ),
'type' => 'text',
'option_category' => 'basic_option',
'description' => __( 'This defines the HTML ALT text. A short description of your image can be placed here.', 'et_builder' ),
),
'logo_title' => array(
'label' => __( 'Logo Title', 'et_builder' ),
'type' => 'text',
'option_category' => 'basic_option',
'description' => __( 'This defines the HTML Title text.', 'et_builder' ),
),
'content_orientation' => array(
'label' => __( 'Text Vertical Alignment', 'et_builder' ),
'type' => 'select',
'option_category' => 'layout',
'options' => array(
'center' => __( 'Center', 'et_builder' ),
'bottom' => __( 'Bottom', 'et_builder' ),
),
'description' => __( 'This setting determines the vertical alignment of your content. Your content can either be vertically centered, or aligned to the bottom.', 'et_builder' ),
'depends_show_if' => 'on',
),
'header_image_url' => array(
'label' => __( 'Header Image URL', 'et_builder' ),
'type' => 'upload',
'option_category' => 'basic_option',
'upload_button_text' => __( 'Upload an image', 'et_builder' ),
'choose_text' => __( 'Choose an Image', 'et_builder' ),
'update_text' => __( 'Set As Image', 'et_builder' ),
'description' => __( 'Upload your desired image, or type in the URL to the image you would like to display.', 'et_builder' ),
),
'image_orientation' => array(
'label' => __( 'Image Vertical Alignment', 'et_builder' ),
'type' => 'select',
'option_category' => 'layout',
'options' => array(
'center' => __( 'Vertically Centered', 'et_builder' ),
'bottom' => __( 'Bottom', 'et_builder' ),
),
'description' => __( 'This controls the orientation of the image within the module.', 'et_builder' ),
),
'content_new' => array(
'label' => __( 'Content', 'et_builder' ),
'type' => 'tiny_mce',
'option_category' => 'basic_option',
'description' => __( 'Here you can define the content that will be placed within the infobox for the pin.', 'et_builder' ),
),
'admin_label' => array(
'label' => __( 'Admin Label', 'et_builder' ),
'type' => 'text',
'description' => __( 'This will change the label of the module in the builder for easy identification.', 'et_builder' ),
),
'module_id' => array(
'label' => __( 'CSS ID', 'et_builder' ),
'type' => 'text',
'option_category' => 'configuration',
'description' => __( 'Enter an optional CSS ID to be used for this module. An ID can be used to create custom CSS styling, or to create links to particular sections of your page.', 'et_builder' ),
),
'module_class' => array(
'label' => __( 'CSS Class', 'et_builder' ),
'type' => 'text',
'option_category' => 'configuration',
'description' => __( 'Enter optional CSS classes to be used for this module. A CSS class can be used to create custom CSS styling. You can add multiple classes, separated with a space.', 'et_builder' ),
),
);
return $fields;
}
function shortcode_callback( $atts, $content = null, $function_name ) {
$module_id = $this->shortcode_atts['module_id'];
$module_class = $this->shortcode_atts['module_class'];
$title = $this->shortcode_atts['title'];
$subhead = $this->shortcode_atts['subhead'];
$background_layout = $this->shortcode_atts['background_layout'];
$text_orientation = $this->shortcode_atts['text_orientation'];
$title_font = $this->shortcode_atts['title_font'];
$title_font_color = $this->shortcode_atts['title_font_color'];
$title_font_size = $this->shortcode_atts['title_font_size'];
$subhead_font = $this->shortcode_atts['subhead_font'];
$subhead_font_color = $this->shortcode_atts['subhead_font_color'];
$subhead_font_size = $this->shortcode_atts['subhead_font_size'];
$content_font = $this->shortcode_atts['content_font'];
$content_font_color = $this->shortcode_atts['content_font_color'];
$content_font_size = $this->shortcode_atts['content_font_size'];
$button_one_text = $this->shortcode_atts['button_one_text'];
$button_one_url = $this->shortcode_atts['button_one_url'];
$button_two_text = $this->shortcode_atts['button_two_text'];
$button_two_url = $this->shortcode_atts['button_two_url'];
$header_fullscreen = $this->shortcode_atts['header_fullscreen'];
$header_scroll_down = $this->shortcode_atts['header_scroll_down'];
$scroll_down_icon = $this->shortcode_atts['scroll_down_icon'];
$scroll_down_icon_color = $this->shortcode_atts['scroll_down_icon_color'];
$scroll_down_icon_size = $this->shortcode_atts['scroll_down_icon_size'];
$background_url = $this->shortcode_atts['background_url'];
$background_color = $this->shortcode_atts['background_color'];
$background_overlay_color = $this->shortcode_atts['background_overlay_color'];
$parallax = $this->shortcode_atts['parallax'];
$parallax_method = $this->shortcode_atts['parallax_method'];
$logo_image_url = $this->shortcode_atts['logo_image_url'];
$header_image_url = $this->shortcode_atts['header_image_url'];
$content_orientation = $this->shortcode_atts['content_orientation'];
$image_orientation = $this->shortcode_atts['image_orientation'];
$custom_icon_1 = $this->shortcode_atts['button_one_icon'];
$button_custom_1 = $this->shortcode_atts['custom_button_one'];
$custom_icon_2 = $this->shortcode_atts['button_two_icon'];
$button_custom_2 = $this->shortcode_atts['custom_button_two'];
$max_width = $this->shortcode_atts['max_width'];
$logo_title = $this->shortcode_atts['logo_title'];
$logo_alt_text = $this->shortcode_atts['logo_alt_text'];
if ( is_rtl() && 'left' === $text_orientation ) {
$text_orientation = 'right';
}
$module_class = ET_Builder_Element::add_module_order_class( $module_class, $function_name );
if ( '' !== $max_width ) {
ET_Builder_Element::set_style( $function_name, array(
'selector' => '%%order_class%% .header-content',
'declaration' => sprintf(
'max-width: %1$s !important;',
esc_html( et_builder_process_range_value( $max_width ) )
),
) );
}
if ( '' !== $title_font ) {
ET_Builder_Element::set_style( $function_name, array(
'selector' => '%%order_class%%.et_pb_fullwidth_header .header-content h1',
'declaration' => sprintf(
'%1$s',
et_builder_set_element_font( $title_font )
),
) );
}
if ( '' !== $title_font_color ) {
ET_Builder_Element::set_style( $function_name, array(
'selector' => '%%order_class%%.et_pb_fullwidth_header .header-content h1',
'declaration' => sprintf(
'color: %1$s !important;',
esc_html( $title_font_color )
),
) );
}
if ( '' !== $title_font_size ) {
ET_Builder_Element::set_style( $function_name, array(
'selector' => '%%order_class%%.et_pb_fullwidth_header .header-content h1',
'declaration' => sprintf(
'font-size: %1$s;',
esc_html( et_builder_process_range_value( $title_font_size ) )
),
) );
}
if ( '' !== $subhead_font ) {
ET_Builder_Element::set_style( $function_name, array(
'selector' => '%%order_class%%.et_pb_fullwidth_header .et_pb_fullwidth_header_subhead',
'declaration' => sprintf(
'%1$s',
et_builder_set_element_font( $subhead_font )
),
) );
}
if ( '' !== $subhead_font_color ) {
ET_Builder_Element::set_style( $function_name, array(
'selector' => '%%order_class%%.et_pb_fullwidth_header .et_pb_fullwidth_header_subhead',
'declaration' => sprintf(
'color: %1$s !important;',
esc_html( $subhead_font_color )
),
) );
}
if ( '' !== $subhead_font_size ) {
ET_Builder_Element::set_style( $function_name, array(
'selector' => '%%order_class%%.et_pb_fullwidth_header .et_pb_fullwidth_header_subhead',
'declaration' => sprintf(
'font-size: %1$s;',
esc_html( et_builder_process_range_value( $subhead_font_size ) )
),
) );
}
if ( '' !== $content_font ) {
ET_Builder_Element::set_style( $function_name, array(
'selector' => '%%order_class%%.et_pb_fullwidth_header p',
'declaration' => sprintf(
'%1$s',
et_builder_set_element_font( $content_font )
),
) );
}
if ( '' !== $content_font_color ) {
ET_Builder_Element::set_style( $function_name, array(
'selector' => '%%order_class%%.et_pb_fullwidth_header p',
'declaration' => sprintf(
'color: %1$s !important;',
esc_html( $content_font_color )
),
) );
}
if ( '' !== $content_font_size ) {
ET_Builder_Element::set_style( $function_name, array(
'selector' => '%%order_class%%.et_pb_fullwidth_header p',
'declaration' => sprintf(
'font-size: %1$s;',
esc_html( et_builder_process_range_value( $content_font_size ) )
),
) );
}
if ( '' !== $scroll_down_icon_color ) {
ET_Builder_Element::set_style( $function_name, array(
'selector' => '%%order_class%%.et_pb_fullwidth_header .et_pb_fullwidth_header_scroll a .et-pb-icon',
'declaration' => sprintf(
'color: %1$s;',
esc_html( $scroll_down_icon_color )
),
) );
}
if ( '' !== $scroll_down_icon_size ) {
ET_Builder_Element::set_style( $function_name, array(
'selector' => '%%order_class%%.et_pb_fullwidth_header .et_pb_fullwidth_header_scroll a .et-pb-icon',
'declaration' => sprintf(
'font-size: %1$s;',
esc_html( et_builder_process_range_value( $scroll_down_icon_size ) )
),
) );
}
if ( '' !== $background_color ) {
ET_Builder_Element::set_style( $function_name, array(
'selector' => '%%order_class%%.et_pb_fullwidth_header',
'declaration' => sprintf(
'background-color: %1$s;',
esc_html( $background_color )
),
) );
}
if ( '' !== $background_overlay_color ) {
ET_Builder_Element::set_style( $function_name, array(
'selector' => '%%order_class%%.et_pb_fullwidth_header .et_pb_fullwidth_header_overlay',
'declaration' => sprintf(
'background-color: %1$s;',
esc_html( $background_overlay_color )
),
) );
}
if ( '' !== $background_url && 'off' === $parallax ) {
ET_Builder_Element::set_style( $function_name, array(
'selector' => '%%order_class%%.et_pb_fullwidth_header',
'declaration' => sprintf(
'background-image: url(%1$s);',
esc_html( $background_url )
),
) );
}
$button_output = '';
if ( '' !== $button_one_text ) {
$button_output .= sprintf(
'
%1$s',
( '' !== $button_one_text ? esc_attr( $button_one_text ) : '' ),
( '' !== $button_one_url ? esc_attr( $button_one_url ) : '#' ),
'' !== $custom_icon_1 && 'on' === $button_custom_1 ? sprintf(
' data-icon="%1$s"',
esc_attr( et_pb_process_font_icon( $custom_icon_1 ) )
) : '',
'' !== $custom_icon_1 && 'on' === $button_custom_1 ? ' et_pb_custom_button_icon' : ''
);
}
if ( '' !== $button_two_text ) {
$button_output .= sprintf(
'
%1$s',
( '' !== $button_two_text ? esc_attr( $button_two_text ) : '' ),
( '' !== $button_two_url ? esc_attr( $button_two_url ) : '#' ),
'' !== $custom_icon_2 && 'on' === $button_custom_2 ? sprintf(
' data-icon="%1$s"',
esc_attr( et_pb_process_font_icon( $custom_icon_2 ) )
) : '',
'' !== $custom_icon_2 && 'on' === $button_custom_2 ? ' et_pb_custom_button_icon' : ''
);
}
$class = " et_pb_module et_pb_bg_layout_{$background_layout} et_pb_text_align_{$text_orientation}";
$header_content = '';
if ( '' !== $title || '' !== $subhead || '' !== $content || '' !== $button_output || '' !== $logo_image_url ) {
$logo_image = '';
if ( '' !== $logo_image_url ){
$logo_image = sprintf(
'

',
esc_attr( $logo_image_url ),
esc_attr( $logo_alt_text ),
( '' !== $logo_title ? sprintf( ' title="%1$s"', esc_attr( $logo_title ) ) : '' )
);
}
$header_content = sprintf(
'',
( $title ? sprintf( '
%1$s
', $title ) : '' ),
( $subhead ? sprintf( '', $subhead ) : '' ),
$logo_image,
( '' !== $content ? sprintf( '
%1$s
', $this->shortcode_content ) : '' ),
( '' !== $button_output ? $button_output : '' ),
( '' !== $content_orientation ? sprintf( ' %1$s', $content_orientation ) : '' )
);
}
$header_image = '';
if ( '' !== $header_image_url ) {
$header_image = sprintf(
'',
( '' !== $header_image_url ? esc_attr( $header_image_url ) : ''),
( '' !== $image_orientation ? sprintf( ' %1$s', $image_orientation ) : '' )
);
$module_class .= ' et_pb_header_with_image';
}
$scroll_down_output = '';
if ( 'off' !== $header_scroll_down || '' !== $scroll_down_icon ) {
$scroll_down_output .= sprintf(
'
%1$s',
esc_html( et_pb_process_font_icon( $scroll_down_icon, 'et_pb_get_font_down_icon_symbols' ) )
);
}
$output = sprintf(
'',
( 'off' !== $header_fullscreen ? ' et_pb_fullscreen' : '' ),
( '' !== $header_content ? $header_content : '' ),
( '' !== $header_image ? $header_image : '' ),
( 'off' !== $header_scroll_down ? $scroll_down_output : '' ),
( '' !== $text_orientation ? sprintf( ' %1$s', esc_attr( $text_orientation ) ) : '' ),
( '' !== $background_url && 'on' === $parallax
? sprintf(
'
',
esc_attr( $background_url ),
( 'off' === $parallax_method ? ' et_pb_parallax_css' : '' )
)
: ''
),
( '' !== $background_url && 'on' === $parallax ? ' et_pb_section_parallax' : '' ),
esc_attr( $class ),
( '' !== $module_id ? sprintf( ' id="%1$s"', esc_attr( $module_id ) ) : '' ),
( '' !== $module_class ? sprintf( ' %1$s', esc_attr( $module_class ) ) : '' )
);
return $output;
}
}
new ET_Builder_Module_Fullwidth_Header;
class ET_Builder_Module_Fullwidth_Menu extends ET_Builder_Module {
function init() {
$this->name = __( 'Fullwidth Menu', 'et_builder' );
$this->slug = 'et_pb_fullwidth_menu';
$this->fullwidth = true;
$this->whitelisted_fields = array(
'menu_id',
'background_color',
'background_layout',
'text_orientation',
'submenu_direction',
'admin_label',
'module_id',
'module_class',
'fullwidth_menu',
'active_link_color',
'dropdown_menu_bg_color',
'dropdown_menu_line_color',
'dropdown_menu_text_color',
'dropdown_menu_animation',
'mobile_menu_bg_color',
'mobile_menu_text_color',
);
$this->main_css_element = '%%order_class%%.et_pb_fullwidth_menu';
$this->advanced_options = array(
'fonts' => array(
'menu' => array(
'label' => __( 'Menu', 'et_builder' ),
'css' => array(
'main' => "{$this->main_css_element} ul li a",
),
'line_height' => array(
'default' => '1em',
),
'font_size' => array(
'default' => '14px',
'range_settings' => array(
'min' => '12',
'max' => '24',
'step' => '1',
),
),
'letter_spacing' => array(
'default' => '0px',
'range_settings' => array(
'min' => '0',
'max' => '8',
'step' => '1',
),
),
),
),
);
$this->fields_defaults = array(
'background_color' => array( '#ffffff', 'only_default_setting' ),
'background_layout' => array( 'light' ),
'text_orientation' => array( 'left' ),
);
}
function get_fields() {
$fields = array(
'menu_id' => array(
'label' => __( 'Menu', 'et_builder' ),
'type' => 'select',
'option_category' => 'basic_option',
'options' => et_builder_get_nav_menus_options(),
'description' => sprintf(
'
%2$s. %3$s.
',
esc_url( admin_url( 'nav-menus.php' ) ),
esc_html__( 'Select a menu that should be used in the module', 'et_builder' ),
esc_html__( 'Click here to create new menu', 'et_builder' )
),
),
'background_color' => array(
'label' => __( 'Background Color', 'et_builder' ),
'type' => 'color-alpha',
'description' => __( 'Use the color picker to choose a background color for this module.', 'et_builder' ),
),
'background_layout' => array(
'label' => __( 'Text Color', 'et_builder' ),
'type' => 'select',
'option_category' => 'color_option',
'options' => array(
'light' => __( 'Dark', 'et_builder' ),
'dark' => __( 'Light', 'et_builder' ),
),
'description' => __( 'Here you can choose the value of your text. If you are working with a dark background, then your text should be set to light. If you are working with a light background, then your text should be dark.', 'et_builder' ),
),
'text_orientation' => array(
'label' => __( 'Text Orientation', 'et_builder' ),
'type' => 'select',
'option_category' => 'layout',
'options' => et_builder_get_text_orientation_options(),
'description' => __( 'This controls the how your text is aligned within the module.', 'et_builder' ),
),
'submenu_direction' => array(
'label' => __( 'Sub-Menus Open', 'et_builder' ),
'type' => 'select',
'option_category' => 'configuration',
'options' => array(
'downwards' => __( 'Downwards', 'et_builder' ),
'upwards' => __( 'Upwards', 'et_builder' ),
),
'description' => __( 'Here you can choose the direction that your sub-menus will open. You can choose to have them open downwards or upwards.', 'et_builder' ),
),
'admin_label' => array(
'label' => __( 'Admin Label', 'et_builder' ),
'type' => 'text',
'description' => __( 'This will change the label of the module in the builder for easy identification.', 'et_builder' ),
),
'module_id' => array(
'label' => __( 'CSS ID', 'et_builder' ),
'type' => 'text',
'option_category' => 'configuration',
'description' => __( 'Enter an optional CSS ID to be used for this module. An ID can be used to create custom CSS styling, or to create links to particular sections of your page.', 'et_builder' ),
),
'module_class' => array(
'label' => __( 'CSS Class', 'et_builder' ),
'type' => 'text',
'option_category' => 'configuration',
'description' => __( 'Enter optional CSS classes to be used for this module. A CSS class can be used to create custom CSS styling. You can add multiple classes, separated with a space.', 'et_builder' ),
),
'fullwidth_menu' => array(
'label' => __( 'Make Menu Links Fullwidth', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'layout',
'options' => array(
'off' => __( 'No', 'et_builder' ),
'on' => __( 'Yes', 'et_builder' ),
),
'tab_slug' => 'advanced',
),
'active_link_color' => array(
'label' => __( 'Active Link Color', 'et_builder' ),
'type' => 'color-alpha',
'custom_color' => true,
'tab_slug' => 'advanced',
),
'dropdown_menu_bg_color' => array(
'label' => __( 'Dropdown Menu Background Color', 'et_builder' ),
'type' => 'color-alpha',
'custom_color' => true,
'tab_slug' => 'advanced',
),
'dropdown_menu_line_color' => array(
'label' => __( 'Dropdown Menu Line Color', 'et_builder' ),
'type' => 'color-alpha',
'custom_color' => true,
'tab_slug' => 'advanced',
),
'dropdown_menu_text_color' => array(
'label' => __( 'Dropdown Menu Text Color', 'et_builder' ),
'type' => 'color-alpha',
'custom_color' => true,
'tab_slug' => 'advanced',
),
'dropdown_menu_animation' => array(
'label' => __( 'Dropdown Menu Animation', 'et_builder' ),
'type' => 'select',
'option_category' => 'configuration',
'options' => array(
'fade' => __( 'Fade', 'et_builder' ),
'expand' => __( 'Expand', 'et_builder' ),
'slide' => __( 'Slide', 'et_builder' ),
'flip' => __( 'Flip', 'et_builder' ),
),
'tab_slug' => 'advanced',
),
'mobile_menu_bg_color' => array(
'label' => __( 'Mobile Menu Background Color', 'et_builder' ),
'type' => 'color-alpha',
'custom_color' => true,
'tab_slug' => 'advanced',
),
'mobile_menu_text_color' => array(
'label' => __( 'Mobile Menu Text Color', 'et_builder' ),
'type' => 'color-alpha',
'custom_color' => true,
'tab_slug' => 'advanced',
),
);
return $fields;
}
function shortcode_callback( $atts, $content = null, $function_name ) {
$module_id = $this->shortcode_atts['module_id'];
$module_class = $this->shortcode_atts['module_class'];
$background_color = $this->shortcode_atts['background_color'];
$background_layout = $this->shortcode_atts['background_layout'];
$text_orientation = $this->shortcode_atts['text_orientation'];
$menu_id = $this->shortcode_atts['menu_id'];
$submenu_direction = $this->shortcode_atts['submenu_direction'];
$fullwidth_menu = $this->shortcode_atts['fullwidth_menu'] === 'on' ? ' et_pb_fullwidth_menu_fullwidth' : '';
$active_link_color = $this->shortcode_atts['active_link_color'];
$dropdown_menu_bg_color = $this->shortcode_atts['dropdown_menu_bg_color'];
$dropdown_menu_line_color = $this->shortcode_atts['dropdown_menu_line_color'];
$dropdown_menu_text_color = $this->shortcode_atts['dropdown_menu_text_color'];
$dropdown_menu_animation = $this->shortcode_atts['dropdown_menu_animation'];
$mobile_menu_bg_color = $this->shortcode_atts['mobile_menu_bg_color'];
$mobile_menu_text_color = $this->shortcode_atts['mobile_menu_text_color'];
if ( is_rtl() && 'left' === $text_orientation ) {
$text_orientation = 'right';
}
$style = '';
if ( '' !== $background_color ) {
$style .= sprintf( ' style="background-color: %s;"',
esc_attr( $background_color )
);
}
$module_class = ET_Builder_Element::add_module_order_class( $module_class, $function_name );
$class = " et_pb_module et_pb_bg_layout_{$background_layout} et_pb_text_align_{$text_orientation} et_dropdown_animation_{$dropdown_menu_animation}{$fullwidth_menu}";
$menu = '';
if ( '' !== $active_link_color ) {
ET_Builder_Element::set_style( $function_name, array(
'selector' => '%%order_class%%.et_pb_fullwidth_menu ul li a:active',
'declaration' => sprintf(
'color: %1$s !important;',
esc_html( $active_link_color )
),
) );
}
if ( '' !== $dropdown_menu_bg_color ) {
ET_Builder_Element::set_style( $function_name, array(
'selector' => '%%order_class%%.et_pb_fullwidth_menu .nav li ul',
'declaration' => sprintf(
'background-color: %1$s !important;',
esc_html( $dropdown_menu_bg_color )
),
) );
}
if ( '' !== $dropdown_menu_line_color ) {
ET_Builder_Element::set_style( $function_name, array(
'selector' => '%%order_class%%.et_pb_fullwidth_menu .nav li ul',
'declaration' => sprintf(
'border-color: %1$s;',
esc_html( $dropdown_menu_line_color )
),
) );
ET_Builder_Element::set_style( $function_name, array(
'selector' => '%%order_class%%.et_pb_fullwidth_menu .et_mobile_menu',
'declaration' => sprintf(
'border-color: %1$s;',
esc_html( $dropdown_menu_line_color )
),
) );
}
if ( '' !== $dropdown_menu_text_color ) {
ET_Builder_Element::set_style( $function_name, array(
'selector' => '%%order_class%%.et_pb_fullwidth_menu .nav li ul a',
'declaration' => sprintf(
'color: %1$s !important;',
esc_html( $dropdown_menu_text_color )
),
) );
}
if ( '' !== $mobile_menu_bg_color ) {
ET_Builder_Element::set_style( $function_name, array(
'selector' => '%%order_class%%.et_pb_fullwidth_menu .et_mobile_menu, %%order_class%%.et_pb_fullwidth_menu .et_mobile_menu ul',
'declaration' => sprintf(
'background-color: %1$s !important;',
esc_html( $mobile_menu_bg_color )
),
) );
}
if ( '' !== $mobile_menu_text_color ) {
ET_Builder_Element::set_style( $function_name, array(
'selector' => '%%order_class%%.et_pb_fullwidth_menu .et_mobile_menu a',
'declaration' => sprintf(
'color: %1$s !important;',
esc_html( $mobile_menu_text_color )
),
) );
}
$output = sprintf(
'',
$menu,
$style,
esc_attr( $class ),
( '' !== $module_id ? sprintf( ' id="%1$s"', esc_attr( $module_id ) ) : '' ),
( '' !== $module_class ? sprintf( ' %1$s', esc_attr( $module_class ) ) : '' ),
( '' !== $style ? sprintf( ' data-bg_color=%1$s', esc_attr( $background_color ) ) : '' )
);
return $output;
}
}
new ET_Builder_Module_Fullwidth_Menu;
class ET_Builder_Module_Fullwidth_Slider extends ET_Builder_Module {
function init() {
$this->name = __( 'Fullwidth Slider', 'et_builder' );
$this->slug = 'et_pb_fullwidth_slider';
$this->fullwidth = true;
$this->child_slug = 'et_pb_slide';
$this->child_item_text = __( 'Slide', 'et_builder' );
$this->whitelisted_fields = array(
'show_arrows',
'show_pagination',
'auto',
'auto_speed',
'auto_ignore_hover',
'parallax',
'parallax_method',
'remove_inner_shadow',
'background_position',
'background_size',
'admin_label',
'module_id',
'module_class',
'top_padding',
'bottom_padding',
'hide_content_on_mobile',
'hide_cta_on_mobile',
'show_image_video_mobile',
);
$this->fields_defaults = array(
'show_arrows' => array( 'on' ),
'show_pagination' => array( 'on' ),
'auto' => array( 'off' ),
'auto_speed' => array( '7000' ),
'auto_ignore_hover' => array( 'off' ),
'parallax' => array( 'off' ),
'parallax_method' => array( 'off' ),
'remove_inner_shadow' => array( 'off' ),
'background_position' => array( 'default' ),
'background_size' => array( 'default' ),
'hide_content_on_mobile' => array( 'off' ),
'hide_cta_on_mobile' => array( 'off' ),
'show_image_video_mobile' => array( 'off' ),
);
$this->main_css_element = '%%order_class%%.et_pb_slider';
$this->advanced_options = array(
'fonts' => array(
'header' => array(
'label' => __( 'Header', 'et_builder' ),
'css' => array(
'main' => "{$this->main_css_element} .et_pb_slide_description h2",
'important' => array(
'color',
),
),
),
'body' => array(
'label' => __( 'Body', 'et_builder' ),
'css' => array(
'main' => "{$this->main_css_element} .et_pb_slide_content",
'line_height' => "{$this->main_css_element} p",
),
),
),
'button' => array(
'button' => array(
'label' => __( 'Button', 'et_builder' ),
),
),
);
$this->custom_css_options = array(
'slide_description' => array(
'label' => __( 'Slide Description', 'et_builder' ),
'selector' => '.et_pb_slide_description',
),
'slide_title' => array(
'label' => __( 'Slide Title', 'et_builder' ),
'selector' => '.et_pb_slide_description h2',
),
'slide_button' => array(
'label' => __( 'Slide Button', 'et_builder' ),
'selector' => 'a.et_pb_more_button',
),
'slide_controllers' => array(
'label' => __( 'Slide Controllers', 'et_builder' ),
'selector' => '.et-pb-controllers',
),
'slide_active_controller' => array(
'label' => __( 'Slide Active Controller', 'et_builder' ),
'selector' => '.et-pb-controllers .et-pb-active-control',
),
);
}
function get_fields() {
$fields = array(
'show_arrows' => array(
'label' => __( 'Arrows', 'et_builder' ),
'type' => 'select',
'option_category' => 'configuration',
'options' => array(
'on' => __( 'Show Arrows', 'et_builder' ),
'off' => __( 'Hide Arrows', 'et_builder' ),
),
'description' => __( 'This setting allows you to turn the navigation arrows on or off.', 'et_builder' ),
),
'show_pagination' => array(
'label' => __( 'Controls', 'et_builder' ),
'type' => 'select',
'option_category' => 'configuration',
'options' => array(
'on' => __( 'Show Slider Controls', 'et_builder' ),
'off' => __( 'Hide Slider Controls', 'et_builder' ),
),
'description' => __( 'Disabling this option will remove the circle button at the bottom of the slider.', 'et_builder' ),
),
'auto' => array(
'label' => __( 'Automatic Animation', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'options' => array(
'off' => __( 'Off', 'et_builder' ),
'on' => __( 'On', 'et_builder' ),
),
'affects' => array(
'#et_pb_auto_speed, #et_pb_auto_ignore_hover',
),
'description' => __( 'If you would like the slider to slide automatically, without the visitor having to click the next button, enable this option and then adjust the rotation speed below if desired.', 'et_builder' ),
),
'auto_speed' => array(
'label' => __( 'Automatic Animation Speed (in ms)', 'et_builder' ),
'type' => 'text',
'option_category' => 'configuration',
'depends_default' => true,
'description' => __( "Here you can designate how fast the slider fades between each slide, if 'Automatic Animation' option is enabled above. The higher the number the longer the pause between each rotation.", 'et_builder' ),
),
'auto_ignore_hover' => array(
'label' => __( 'Continue Automatic Slide on Hover', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'depends_default' => true,
'options' => array(
'off' => __( 'Off', 'et_builder' ),
'on' => __( 'On', 'et_builder' ),
),
'description' => __( 'Turning this on will allow automatic sliding to continue on mouse hover.', 'et_builder' ),
),
'parallax' => array(
'label' => __( 'Use Parallax effect', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'options' => array(
'off' => __( 'No', 'et_builder' ),
'on' => __( 'Yes', 'et_builder' ),
),
'affects' => array(
'#et_pb_parallax_method',
),
'description' => __( 'If enabled, your background images will have a fixed position as your scroll, creating a fun parallax-like effect.', 'et_builder' ),
),
'parallax_method' => array(
'label' => __( 'Parallax method', 'et_builder' ),
'type' => 'select',
'option_category' => 'configuration',
'options' => array(
'off' => __( 'CSS', 'et_builder' ),
'on' => __( 'True Parallax', 'et_builder' ),
),
'depends_show_if' => 'on',
'description' => __( 'Define the method, used for the parallax effect.', 'et_builder' ),
),
'remove_inner_shadow' => array(
'label' => __( 'Remove Inner Shadow', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'options' => array(
'off' => __( 'No', 'et_builder' ),
'on' => __( 'Yes', 'et_builder' ),
),
),
'background_position' => array(
'label' => __( 'Background Image Position', 'et_builder' ),
'type' => 'select',
'option_category' => 'layout',
'options' => array(
'default' => __( 'Default', 'et_builder' ),
'top_left' => __( 'Top Left', 'et_builder' ),
'top_center' => __( 'Top Center', 'et_builder' ),
'top_right' => __( 'Top Right', 'et_builder' ),
'center_right' => __( 'Center Right', 'et_builder' ),
'center_left' => __( 'Center Left', 'et_builder' ),
'bottom_left' => __( 'Bottom Left', 'et_builder' ),
'bottom_center' => __( 'Bottom Center', 'et_builder' ),
'bottom_right' => __( 'Bottom Right', 'et_builder' ),
),
'depends_show_if' => 'off',
),
'background_size' => array(
'label' => __( 'Background Image Size', 'et_builder' ),
'type' => 'select',
'option_category' => 'layout',
'options' => array(
'default' => __( 'Default', 'et_builder' ),
'contain' => __( 'Fit', 'et_builder' ),
'initial' => __( 'Actual Size', 'et_builder' ),
),
'depends_show_if' => 'off',
),
'admin_label' => array(
'label' => __( 'Admin Label', 'et_builder' ),
'type' => 'text',
'description' => __( 'This will change the label of the module in the builder for easy identification.', 'et_builder' ),
),
'module_id' => array(
'label' => __( 'CSS ID', 'et_builder' ),
'type' => 'text',
'option_category' => 'configuration',
'description' => __( 'Enter an optional CSS ID to be used for this module. An ID can be used to create custom CSS styling, or to create links to particular sections of your page.', 'et_builder' ),
),
'module_class' => array(
'label' => __( 'CSS Class', 'et_builder' ),
'type' => 'text',
'option_category' => 'configuration',
'description' => __( 'Enter optional CSS classes to be used for this module. A CSS class can be used to create custom CSS styling. You can add multiple classes, separated with a space.', 'et_builder' ),
),
'top_padding' => array(
'label' => __( 'Top Padding', 'et_builder' ),
'type' => 'text',
'option_category' => 'layout',
'tab_slug' => 'advanced',
),
'bottom_padding' => array(
'label' => __( 'Bottom Padding', 'et_builder' ),
'type' => 'text',
'option_category' => 'layout',
'tab_slug' => 'advanced',
),
'hide_content_on_mobile' => array(
'label' => __( 'Hide Content On Mobile', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'layout',
'options' => array(
'off' => __( 'No', 'et_builder' ),
'on' => __( 'Yes', 'et_builder' ),
),
'tab_slug' => 'advanced',
),
'hide_cta_on_mobile' => array(
'label' => __( 'Hide CTA On Mobile', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'layout',
'options' => array(
'off' => __( 'No', 'et_builder' ),
'on' => __( 'Yes', 'et_builder' ),
),
'tab_slug' => 'advanced',
),
'show_image_video_mobile' => array(
'label' => __( 'Show Image / Video On Mobile', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'layout',
'options' => array(
'off' => __( 'No', 'et_builder' ),
'on' => __( 'Yes', 'et_builder' ),
),
'tab_slug' => 'advanced',
),
);
return $fields;
}
function pre_shortcode_content() {
global $et_pb_slider_has_video, $et_pb_slider_parallax, $et_pb_slider_parallax_method, $et_pb_slider_hide_mobile, $et_pb_slider_custom_icon, $et_pb_slider_item_num;
$et_pb_slider_item_num = 0;
$parallax = $this->shortcode_atts['parallax'];
$parallax_method = $this->shortcode_atts['parallax_method'];
$hide_content_on_mobile = $this->shortcode_atts['hide_content_on_mobile'];
$hide_cta_on_mobile = $this->shortcode_atts['hide_cta_on_mobile'];
$button_custom = $this->shortcode_atts['custom_button'];
$custom_icon = $this->shortcode_atts['button_icon'];
$et_pb_slider_has_video = false;
$et_pb_slider_parallax = $parallax;
$et_pb_slider_parallax_method = $parallax_method;
$et_pb_slider_hide_mobile = array(
'hide_content_on_mobile' => $hide_content_on_mobile,
'hide_cta_on_mobile' => $hide_cta_on_mobile,
);
$et_pb_slider_custom_icon = 'on' === $button_custom ? $custom_icon : '';
}
function shortcode_callback( $atts, $content = null, $function_name ) {
$module_id = $this->shortcode_atts['module_id'];
$module_class = $this->shortcode_atts['module_class'];
$show_arrows = $this->shortcode_atts['show_arrows'];
$show_pagination = $this->shortcode_atts['show_pagination'];
$parallax = $this->shortcode_atts['parallax'];
$parallax_method = $this->shortcode_atts['parallax_method'];
$auto = $this->shortcode_atts['auto'];
$auto_speed = $this->shortcode_atts['auto_speed'];
$auto_ignore_hover = $this->shortcode_atts['auto_ignore_hover'];
$top_padding = $this->shortcode_atts['top_padding'];
$bottom_padding = $this->shortcode_atts['bottom_padding'];
$remove_inner_shadow = $this->shortcode_atts['remove_inner_shadow'];
$show_image_video_mobile = $this->shortcode_atts['show_image_video_mobile'];
$background_position = $this->shortcode_atts['background_position'];
$background_size = $this->shortcode_atts['background_size'];
global $et_pb_slider_has_video, $et_pb_slider_parallax, $et_pb_slider_parallax_method, $et_pb_slider_hide_mobile, $et_pb_slider_custom_icon;
$content = $this->shortcode_content;
$module_class = ET_Builder_Element::add_module_order_class( $module_class, $function_name );
if ( '' !== $top_padding ) {
ET_Builder_Element::set_style( $function_name, array(
'selector' => '%%order_class%% .et_pb_slide_description',
'declaration' => sprintf(
'padding-top: %1$s;',
esc_html( et_builder_process_range_value( $top_padding ) )
),
) );
}
if ( '' !== $bottom_padding ) {
ET_Builder_Element::set_style( $function_name, array(
'selector' => '%%order_class%% .et_pb_slide_description',
'declaration' => sprintf(
'padding-bottom: %1$s;',
esc_html( et_builder_process_range_value( $bottom_padding ) )
),
) );
}
if ( 'default' !== $background_position && 'off' === $parallax ) {
$processed_position = str_replace( '_', ' ', $background_position );
ET_Builder_Module::set_style( $function_name, array(
'selector' => '%%order_class%% .et_pb_slide',
'declaration' => sprintf(
'background-position: %1$s;',
esc_html( $processed_position )
),
) );
}
if ( 'default' !== $background_size && 'off' === $parallax ) {
ET_Builder_Module::set_style( $function_name, array(
'selector' => '%%order_class%% .et_pb_slide',
'declaration' => sprintf(
'-moz-background-size: %1$s;
-webkit-background-size: %1$s;
background-size: %1$s;',
esc_html( $background_size )
),
) );
}
$fullwidth = 'et_pb_fullwidth_slider' === $function_name ? 'on' : 'off';
$class = '';
$class .= 'off' === $fullwidth ? ' et_pb_slider_fullwidth_off' : '';
$class .= 'off' === $show_arrows ? ' et_pb_slider_no_arrows' : '';
$class .= 'off' === $show_pagination ? ' et_pb_slider_no_pagination' : '';
$class .= 'on' === $parallax ? ' et_pb_slider_parallax' : '';
$class .= 'on' === $auto ? ' et_slider_auto et_slider_speed_' . esc_attr( $auto_speed ) : '';
$class .= 'on' === $auto_ignore_hover ? ' et_slider_auto_ignore_hover' : '';
$class .= 'on' === $remove_inner_shadow ? ' et_pb_slider_no_shadow' : '';
$class .= 'on' === $show_image_video_mobile ? ' et_pb_slider_show_image' : '';
$output = sprintf(
'
',
$class,
$content,
( $et_pb_slider_has_video ? ' et_pb_preload' : '' ),
( '' !== $module_id ? sprintf( ' id="%1$s"', esc_attr( $module_id ) ) : '' ),
( '' !== $module_class ? sprintf( ' %1$s', esc_attr( $module_class ) ) : '' )
);
return $output;
}
}
new ET_Builder_Module_Fullwidth_Slider;
class ET_Builder_Module_Fullwidth_Portfolio extends ET_Builder_Module {
function init() {
$this->name = __( 'Fullwidth Portfolio', 'et_builder' );
$this->slug = 'et_pb_fullwidth_portfolio';
$this->fullwidth = true;
$this->whitelisted_fields = array(
'title',
'fullwidth',
'include_categories',
'posts_number',
'show_title',
'show_date',
'background_layout',
'auto',
'auto_speed',
'admin_label',
'module_id',
'module_class',
);
$this->fields_defaults = array(
'fullwidth' => array( 'on' ),
'show_title' => array( 'on' ),
'show_date' => array( 'on' ),
'background_layout' => array( 'light' ),
'auto' => array( 'off' ),
'auto_speed' => array( '7000' ),
);
}
function get_fields() {
$fields = array(
'title' => array(
'label' => __( 'Portfolio Title', 'et_builder' ),
'type' => 'text',
'option_category' => 'basic_option',
'description' => __( 'Title displayed above the portfolio.', 'et_builder' ),
),
'fullwidth' => array(
'label' => __( 'Layout', 'et_builder' ),
'type' => 'select',
'option_category' => 'layout',
'options' => array(
'on' => __( 'Carousel', 'et_builder' ),
'off' => __( 'Grid', 'et_builder' ),
),
'affects' => array(
'#et_pb_auto',
),
'description' => __( 'Choose your desired portfolio layout style.', 'et_builder' ),
),
'include_categories' => array(
'label' => __( 'Include Categories', 'et_builder' ),
'renderer' => 'et_builder_include_categories_option',
'option_category' => 'basic_option',
'description' => __( 'Select the categories that you would like to include in the feed.', 'et_builder' ),
),
'posts_number' => array(
'label' => __( 'Posts Number', 'et_builder' ),
'type' => 'text',
'option_category' => 'configuration',
'description' => __( 'Control how many projects are displayed. Leave blank or use 0 to not limit the amount.', 'et_builder' ),
),
'show_title' => array(
'label' => __( 'Show Title', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'options' => array(
'on' => __( 'Yes', 'et_builder' ),
'off' => __( 'No', 'et_builder' ),
),
'description' => __( 'Turn project titles on or off.', 'et_builder' ),
),
'show_date' => array(
'label' => __( 'Show Date', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'options' => array(
'on' => __( 'Yes', 'et_builder' ),
'off' => __( 'No', 'et_builder' ),
),
'description' => __( 'Turn the date display on or off.', 'et_builder' ),
),
'background_layout' => array(
'label' => __( 'Text Color', 'et_builder' ),
'type' => 'select',
'option_category' => 'color_option',
'options' => array(
'light' => __( 'Dark', 'et_builder' ),
'dark' => __( 'Light', 'et_builder' ),
),
'description' => __( 'Here you can choose whether your text should be light or dark. If you are working with a dark background, then your text should be light. If your background is light, then your text should be set to dark.', 'et_builder' ),
),
'auto' => array(
'label' => __( 'Automatic Carousel Rotation', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'options' => array(
'off' => __( 'Off', 'et_builder' ),
'on' => __( 'On', 'et_builder' ),
),
'affects' => array(
'#et_pb_auto_speed',
),
'depends_show_if' => 'on',
'description' => __( 'If you the carousel layout option is chosen and you would like the carousel to slide automatically, without the visitor having to click the next button, enable this option and then adjust the rotation speed below if desired.', 'et_builder' ),
),
'auto_speed' => array(
'label' => __( 'Automatic Carousel Rotation Speed (in ms)', 'et_builder' ),
'type' => 'text',
'option_category' => 'configuration',
'depends_default' => true,
'description' => __( "Here you can designate how fast the carousel rotates, if 'Automatic Carousel Rotation' option is enabled above. The higher the number the longer the pause between each rotation. (Ex. 1000 = 1 sec)", 'et_builder' ),
),
'admin_label' => array(
'label' => __( 'Admin Label', 'et_builder' ),
'type' => 'text',
'description' => __( 'This will change the label of the module in the builder for easy identification.', 'et_builder' ),
),
'module_id' => array(
'label' => __( 'CSS ID', 'et_builder' ),
'type' => 'text',
'option_category' => 'configuration',
'description' => __( 'Enter an optional CSS ID to be used for this module. An ID can be used to create custom CSS styling, or to create links to particular sections of your page.', 'et_builder' ),
),
'module_class' => array(
'label' => __( 'CSS Class', 'et_builder' ),
'type' => 'text',
'option_category' => 'configuration',
'description' => __( 'Enter optional CSS classes to be used for this module. A CSS class can be used to create custom CSS styling. You can add multiple classes, separated with a space.', 'et_builder' ),
),
);
return $fields;
}
function shortcode_callback( $atts, $content = null, $function_name ) {
$title = $this->shortcode_atts['title'];
$module_id = $this->shortcode_atts['module_id'];
$module_class = $this->shortcode_atts['module_class'];
$fullwidth = $this->shortcode_atts['fullwidth'];
$include_categories = $this->shortcode_atts['include_categories'];
$posts_number = $this->shortcode_atts['posts_number'];
$show_title = $this->shortcode_atts['show_title'];
$show_date = $this->shortcode_atts['show_date'];
$background_layout = $this->shortcode_atts['background_layout'];
$auto = $this->shortcode_atts['auto'];
$auto_speed = $this->shortcode_atts['auto_speed'];
$args = array();
if ( is_numeric( $posts_number ) && $posts_number > 0 ) {
$args['posts_per_page'] = $posts_number;
} else {
$args['nopaging'] = true;
}
if ( '' !== $include_categories ) {
$args['tax_query'] = array(
array(
'taxonomy' => 'project_category',
'field' => 'id',
'terms' => explode( ',', $include_categories ),
'operator' => 'IN'
)
);
}
$projects = et_divi_get_projects( $args );
ob_start();
if( $projects->post_count > 0 ) {
while ( $projects->have_posts() ) {
$projects->the_post();
?>
>
$thumb_width ) ? 'portrait' : 'landscape';
if ( '' !== $thumb_src ) : ?>
%8$s
%2$s
',
( 'on' === $fullwidth ? 'et_pb_fullwidth_portfolio_carousel' : 'et_pb_fullwidth_portfolio_grid clearfix' ),
$posts,
esc_attr( $class ),
( '' !== $module_id ? sprintf( ' id="%1$s"', esc_attr( $module_id ) ) : '' ),
( '' !== $module_class ? sprintf( ' %1$s', esc_attr( $module_class ) ) : '' ),
( '' !== $auto && in_array( $auto, array('on', 'off') ) ? esc_attr( $auto ) : 'off' ),
( '' !== $auto_speed && is_numeric( $auto_speed ) ? esc_attr( $auto_speed ) : '7000' ),
( '' !== $title ? sprintf( '