Nội dung

Cách tạo Shortcode trong wordpress

4 năm trước, Code plugin wordpress, Code theme wordpress, 264 Lượt xem

Tạo code trong file funcion.php

//Khởi tạo function cho shortcode
function create_shortcode() {
        echo "Xin chào netweb";
}
//Tạo shortcode tên là [test_shortcode] và sẽ thực thi code từ function create_shortcode
add_shortcode( 'netweb_shortcode', 'create_shortcode' );

Sử dụng Shortcode

[netweb_shortcode]

Sử dụng Shortcode trong php

link: https://developer.wordpress.org/reference/functions/do_shortcode/

echo do_shortcode( '[netweb_shortcode]' );

 

Bài viết mới cập nhập

  • Hướng dẫn Plugin floating contact

    Hướng dẫn Plugin floating contact

    1 năm trước, 380 Lượt xem

    Netweb xin hướng dẫn cách quản lý Plugin floating contact các bạn nhớ làm theo kỹ tường bước để plugin hoạt động Tính năng: Hiển…

  • Backup Yandex Mail

    Backup Yandex Mail

    1 năm trước, 251 Lượt xem

    Khác với dịch vụ email theo tên của microsoft và google với chi phí đắt đỏ tầm 1tr/năm/1user, vì thế nên netweb khuyên dùng dịch…

Bình luận trên facebook netweb.vn

Đam mê thiết kế web, kinh nghiệm 9 năm trong nghề thiết kế website, đang thiết kế web dạo tại netweb.vn, Callme: 08.9898.2526 (Mr Hải)