Get Your FREE The Beginners Guide to SEO

In a fast-paced, dynamic field such as SEO, it is crucial to stay well-informed. Even seasoned SEO experts understand the need to keep on learning lest they become obsolete. Emerging trends. Algorithmic changes. Technological advancements. These are some of the few things every SEO professional should be watching out for. But if you haven’t been keeping an eye on these for whatever reason, don’t worry. We’ve got your covered.

Download Now

Code menu stick

1

Code ứng dụng làm cho các trang như ô tô. Demo như trang: retail.woobank .com.vn ; trang toyotaphutho .com.vn; trang hangkiangvietnam .com

// code menu stick
add_action(‘wp_footer’, ‘menu_stick_js’);
function menu_stick_js() {
global $post;
$post_content = $post->post_content;
if ( has_shortcode( $post_content, ‘MX_menu’ ) ) {?>

array(
'type' => 'colorpicker',
'heading' => __( 'Màu nền', 'flatsome' ),
'format' => 'rgb',
'position' => 'bottom right',
),
'bg_color_hover' => array(
'type' => 'colorpicker',
'heading' => __( 'Màu nền hover', 'flatsome' ),
'format' => 'rgb',
'position' => 'bottom right',
),

'text_color' => array(
'type' => 'colorpicker',
'heading' => __( 'Màu chữ', 'flatsome' ),
'format' => 'rgb',
'position' => 'bottom right',
),
'text_color_hover' => array(
'type' => 'colorpicker',
'heading' => __( 'Màu chữ hover', 'flatsome' ),
'format' => 'rgb',
'position' => 'bottom right',
),
'font_size' => array(
'type' => 'slider',
'heading' => __( 'Font size', 'flatsome' ),
'responsive' => true,
'default' => '14',
'unit' => 'px',
'step' => 1,
),
'border_hover_color' => array(
'type' => 'colorpicker',
'heading' => __( 'Màu hover', 'flatsome' ),
'format' => 'rgb',
'position' => 'bottom right',
),
'height' => array(
'type' => 'slider',
'heading' => __( 'Chiều cao', 'flatsome' ),
'responsive' => true,
'default' => '70',
'unit' => 'px',
'step' => 1,
),

);
add_ux_builder_shortcode( 'MX_menu', array(
'type' => 'container',
'name' => __( 'Menu stick', 'flatsome' ),
'category' => __( 'Content', 'flatsome' ),
'allow' => array( 'MX_menu_link'),

'presets' => array(
array(
'name' => __( 'Default', 'flatsome' ),
'content' => '
[MX_menu]
[MX_menu_link text="Menu link 1"]
[MX_menu_link text="Menu link 2"]
[MX_menu_link text="Menu link 3"]
[MX_menu_link text="Menu link 4"]
[/MX_menu]
',
),
),
'options' => $options,

) );
}
add_action('ux_builder_setup', 'MX_menu_builder');

function MX_menu( $atts, $content, $tag ) {
$atts = shortcode_atts(
array(
'bg_color' => '',
'bg_color_hover' => '',
'text_color' => '',
'text_color_hover' => '',
'font_size' => '',
'border_hover_color' => '',
'height' => '',
),
$atts,
$tag
);

$args = array(
'bg_color' => array(
'selector' => ', .list-tab',
'property' => 'background-color',
),
'bg_color_hover' => array(
'selector' => '.list-tab .tab a.active, .list-tab .tab a:hover ',
'property' => 'background-color',
),
'text_color' => array(
'selector' => '.list-tab .tab a, .selected, .selected:after',
'property' => 'color',
),
'text_color_hover' => array(
'selector' => '.list-tab .tab a.active, .list-tab .tab a:hover ',
'property' => 'color',
),
'font_size' => array(
'selector' => '.list-tab .tab a, .selected',
'property' => 'font-size',
'unit' => 'px',
),
'border_hover_color' => array(
'selector' => '.list-tab .tab a.active:before, .list-tab .tab a:before ',
'property' => 'background-color',
),
'height' => array(
'selector' => ',.list-tab .tab a, .selected',
'property' => 'height',
'unit' => 'px',
),
);

ob_start();

?>

__( 'Menu link', 'flatsome' ),
'category' => __( 'Content', 'flatsome' ),
'info' => '{{ text }}',
'require' => array( 'MX_menu' ),
'wrap' => false,
'presets' => array(
array(
'name' => __( 'Default', 'flatsome' ),
'content' => '[MX_menu_link text="Menu link"]',
),
),
'options' => array(
'text' => array(
'type' => 'textfield',
'heading' => __( 'Text', 'flatsome' ),
'default' => '',
'auto_focus' => true,
),
'link' => array(
'type' => 'textfield',
'heading' => __( 'Liên kết', 'flatsome' ),
'default' => '',
'auto_focus' => true,
),
),
) );
}
add_action('ux_builder_setup', 'MX_menu_link_builder');

function MX_menu_link( $atts, $content, $tag ) {

$atts = shortcode_atts(
array(
'text' => '',
'link' => '',

),
$atts,
$tag
);

$classes = array( 'ux-menu-link flex menu-item' );

$link = trim( $atts['link'] );
if ( ! is_string( $link ) ) {
$link = '';
}

// Ensure paths (except hash) are rendered as full URLs.
if ( substr( $link, 0, 1 ) !== '#' && ! wp_http_validate_url( $link ) ) {
$link = site_url( $link );
}

ob_start();

?>

Comments are closed, but trackbacks and pingbacks are open.

Developed by Tiepthitute
Facebook Messenger
Chat với chúng tôi qua Zalo
Gọi ngay