Tạo theo cấu trúc file wp:
Định nghĩa:
– Post-type: post-type là các module mở rộng tự viết thêm. Ví dụ: Gallery, Event, Logo, Testimonial….
– Taxomony là các phần category tương ứng với các post-type. Giống như Category của phần bài viết.
– Metabox là phần viết thêm dưới mỗi bài viết với post-type tương ứng. Ví dụ:
Với Post-type event: khi thêm event ta sẽ cần thêm các mục như : time event, address event…ở trong mỗi phần bài viết.
– Theme Option: phần tùy chọn hiển thị của theme. Ví dụ: chọn logo, favicon, font, font-size….
Dùng framework: codestar
Cấu hình Theme nằm trong thư mực: /themes/abc/admin
../admin/style.php // Cấu hình các đường dẫn tới file style và javascript —> Xem tại đây
../admin/widget.php // Cấu hình các widget —-> Xem tại đây
./admin/post-type/
1. Template
Thiết đặt các page có code riêng trong thư mực Template:
– ../template/about.php
– /template/homepage.php
– /template/contact.php
– ../template/service.php
Cấu trúc file trong template phải có:
<?php
/*
Template Name: Homepage
Template Post Type: post, page, product
*/
get_header();
?>
Code ở đây
<?php ?>
2. Shortcode
Tạo các shortcode trong file shortcode trong thư mục shortcode
…/shortcode/tab.php
…/shortcode/gallery.php
…/shortcode/about.php
Nội dung file shortcode:
<?php
add_shortcode( ‘about_shortcode’, ‘inno_display_about’ );
function inno_display_about( $atts ) {
$atts = shortcode_atts( array(
‘logo’ => ”,
‘title’ => ”,
‘content1’ => ”,
‘link’ => ”,
‘image1’ => ”,
), $atts, ‘about_shortcode’ );
$logo = $atts[‘logo’];
$logo_url = wp_get_attachment_image_src( $logo, ‘full’ );
$image_id1 = $atts[‘image1’];
$attachment1 = wp_get_attachment_image_src( $image_id1, ‘full’ );
?>
</div>

