logo logo
  • Mới
  • Tài liệu
      • Công cụ
      • Driver
      • Email Yandex
      • Kinh Nghiệm
      • LightSail
      • Mã nguồn
        • Blogspot
          • Chuyên gia Blogspot
        • Odoo
        • WHMCS
        • WooCommerce
        • WordPress
          • Advanced custom fields
          • Elementor
          • Zubi Cloud Builder
        • Xenforo
      • Phần mềm
      • Plugin
      • Quản trị Server
        • CWP – CentOS Web Panel
        • CyberPanel
        • Digital ocean
        • HocVPS Script
        • Vultr
      • SEO
      • Support Admin
      • Tài liệu
        • Quy định – chính sách
        • Zubi Cloud Store
      • Tên miền
      • UltimatePOS
      • Windows
      • Zubi Cloud ID
        • Quản lý Hosting
        • Quản lý tên miền
      • Zubi ERP
  • Tài nguyên
    • Zubi ID
    • Zubi Store
    • Zubi Marketplace
  • Support
    • Liên hệ
    • Support 24/7
    • Quy định - chính sách
  • Bí kít nghề
Dịch vụ

Tài liệu hỗ trợ khách hàng Zubi Cloud

    Popular:

"Lời hứa từ Zubi Group, dịch vụ và sản phẩm của chúng tôi là trọn đời, trường cửu."

  • Trang chủ
  • WordPress
  • Cách tạo Menu kéo thả trong WordPress
14/01/2020 - 291 views

Cách tạo Menu kéo thả trong WordPress

Đánh giá post
  • Tạo nhanh Website WordPress sau khi mua Hosting tại Zubi Cloud
  • Sửa lỗi ảnh thumbnail trùng nhau giữa các ngôn ngữ trong Polylang
  • Nên chọn OpenLiteSpeed ​​hay Nginx cho website WordPress

Zubi Cloud chia sẻ thủ thuật tạo Menu dạng kéo thả trong wordpress, dành cho chuyên gia thiết kế theme wordpress

Table of Contents

  • 1.Cách tạo Menu dạng kéo thả trong wordpress
    • 2. Xem tiếp bài Tạo Section tùy biến kéo thả HTML trong WordPress

1.Cách tạo Menu dạng kéo thả trong wordpress

Chèn đoạn code sau vào file functions.php

add_theme_support( 'menus' ); register_nav_menus( array( 'main-nav' => 'Zubi Cloud Menu top' ) );

Chèn đoạn code sau vào nơi cần hiển thị Menu

<?php wp_nav_menu( array(
'theme_location' => 'main-nav', // tên location cần hiển thị
'container' => 'ul', // thẻ container của menu
) ); ?>

2. Xem tiếp bài Tạo Section tùy biến kéo thả HTML trong WordPress

Chèn đoạn code sau vào file functions.php

require_once get_template_directory() . '/customizer-anbiwebfooter.php';
require_once get_template_directory() . '/customizer-anbiwebhead.php';

Tiếp theo hãy tạo 2 file customizer-anbiwebfooter.php và customizer-anbiwebhead.php ngang hàng với file functions.php trong theme (hoặc có thể đặt 2 file trên vào 1 folder nào đó, tùy ý bạn muốn)

Chèn đoạn code sau vào customizer-anbiwebhead.php

<?php
function head_customize_register($wp_customize) 
{
$wp_customize->add_section("head1", array(
'title' => __("Thay đổi logo, hotline"),
'priority' => 130,
));


//Code upload ảnh
$wp_customize->add_setting("footer_logo", array(
'transport' => 'postMessage',
)); 
$wp_customize->add_control(new WP_Customize_Upload_Control($wp_customize,'footer_logo',array(
'label' => __('Upload ảnh', 'devvn'),
'section' => 'head1',
'settings' => 'footer_logo',
))); 


//Code chèn text
$wp_customize->add_setting("head_text", array(
'default' => '',
'transport' => 'postMessage',
)); 
$wp_customize->add_control(new WP_Customize_Control($wp_customize,"head_text",array(
'label' => __("Thay đổi hotline"),
'section' => 'head1',
'settings' => 'head_text',
'type' => 'textarea',
)));


}
add_action("customize_register","head_customize_register");

Chèn đoạn code sau vào customizer-anbiwebfooter.php

<?php

function footer_customize_register($wp_customize) 
{
$wp_customize->add_section("footer1", array(
'title' => __("Tùy biến Zubi Cloud Footer"),
'priority' => 130,
));

//Footer text
$wp_customize->add_setting("footer_text", array(
'default' => '',
'transport' => 'postMessage',
)); 
$wp_customize->add_control(new WP_Customize_Control($wp_customize,"footer_text",array(
'label' => __("Bản đồ"),
'section' => 'footer1',
'settings' => 'footer_text',
'type' => 'textarea',
)));


//Footer text
$wp_customize->add_setting("footer_text1", array(
'default' => '',
'transport' => 'postMessage',
)); 
$wp_customize->add_control(new WP_Customize_Control($wp_customize,"footer_text1",array(
'label' => __("Like facebook"),
'section' => 'footer1',
'settings' => 'footer_text1',
'type' => 'textarea',
))); 


//Footer text
$wp_customize->add_setting("footer_text2", array(
'default' => '',
'transport' => 'postMessage',
)); 
$wp_customize->add_control(new WP_Customize_Control($wp_customize,"footer_text2",array(
'label' => __("Thông tin công ty"),
'section' => 'footer1',
'settings' => 'footer_text2',
'type' => 'textarea',
))); 


//Footer text
$wp_customize->add_setting("footer_text3", array(
'default' => '',
'transport' => 'postMessage',
)); 
$wp_customize->add_control(new WP_Customize_Control($wp_customize,"footer_text3",array(
'label' => __("Thanh Hotline"),
'section' => 'footer1',
'settings' => 'footer_text3',
'type' => 'textarea',
))); 



}
add_action("customize_register","footer_customize_register");

Cách gọi cách hàm trên, chèn đoạn code sau vào nơi cần hiển thị trong themes:

<?php echo get_theme_mod( 'head_text' ); ?>

hay

<?php echo get_theme_mod( 'footer_logo' ); ?>
Đánh giá post

Tags: carrental_customize, carrental_logo, Customize, head_customize, register_nav_menus, Thay đổi logo, WordPress, wordpress menu



Bài liên quan
  • Code get link affilate sản phẩm của Shopee vào website WordPress
  • Cách chuyển hướng, Redirect trang web in HTML
  • Tự động thêm thẻ alt, title khi upload hình ảnh lên Website WordPress
  • Cách thay đổi User và Mật Khẩu đăng nhập WordPress trong PHPmyadmin
  • Cách kiểm tra User đã login WordPress hay chưa?
  • Công cụ (6)
  • Driver (2)
  • Kinh Nghiệm (1)
  • LightSail (2)
  • Mã nguồn (137)
    • Blogspot (25)
      • Chuyên gia Blogspot (1)
    • Odoo (1)
    • WHMCS (11)
    • WooCommerce (25)
    • WordPress (79)
      • Advanced custom fields (2)
      • Elementor (2)
      • Zubi Cloud Builder (1)
    • Xenforo (4)
  • Phần mềm (2)
  • Plugin (1)
  • Quản trị Server (49)
    • CWP – CentOS Web Panel (5)
    • CyberPanel (23)
    • Digital ocean (1)
    • HocVPS Script (13)
    • Vultr (1)
  • SEO (3)
  • Support Admin (9)
  • Tài liệu (6)
    • Quy định – chính sách (4)
    • Zubi Cloud Store (1)
  • Tên miền (3)
  • UltimatePOS (3)
  • Windows (1)
  • Zubi Cloud ID (5)
    • Quản lý Hosting (4)
    • Quản lý tên miền (1)
  • Zubi ERP (3)
Bài xem nhiều
    • 1 số thư viện cần thiết khi thiết kế template Blogspot chuyên nghiệp

      post 26/08/2020 - 11573 views
    • Cách tạo Favicon biểu tượng trang web cho Blogspot

      post 08/10/2021 - 2869 views
    • Cách sửa lỗi không hiển thị Tawk.to trên Blogspot

      post 20/08/2020 - 2459 views
    • Thay chữ Sale giảm giá bằng % trong woocommerce WordPress

      post 11/08/2019 - 1075 views
    • Code lấy ảnh đầu tiên trong bài viết làm ảnh đại diện Auto Post Thumbnail

      post 11/08/2019 - 772 views

    Các kênh hỗ trợ

    Chúng tôi luôn ở đây 24/7 hỗ trợ bạn, đi cùng bạn trên chặng đường kinh doanh và phát triển doanh nghiệp

  • Kỹ thuật Support

  • Chát trực tuyến 24/7

  • Gửi email

  • Ultraviewer/Teamviewer

1 sản phẩm của Zubi Group
  • Liên hệ
  • Support 24/7
  • Theme Store
  • App Store
  • Quản lý dịch vụ