Thông tin tài liệu
Chương 1. WORDPRESS INTRODUCTION 1.1 1.Một số hàm và đoạn code quan trọng. - Gọi các thành phần vào trang index.php get_header(); get_sidebar(); get_footer(); Code : index.php <?php get_header(); ?> <?php get_sidebar(); ?> <?php get_footer(); ?> footer.php <div id="footer"> <ul> <li>footer</li> <li>footer</li> <li>footer</li> <li>footer</li> </ul> </div> <?php wp_footer(); ?> </body> </html> header.php <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title><?php wp_title(); ?></title> <link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_url'); ?>" > <?php wp_head(); ?> </head> <body <?php body_class(); ?>> <div id="header"> <ul> <li>kagdja</li> <li>kagdja</li> <li>kagdja</li> <li>kagdja</li> </ul> </div> sidebar.php <?php wp_head();?> <div> <ul> <li>sidebar</li> <li>sidebar</li> <li>sidebar</li> <li>sidebar</li> </ul> </div> <?php wp_footer(); ?> Kết quả : Note : -Để lấy các categories và trích đoạn bài post trong các hạng mục đó ta làm như sau : <div class="panel panel-default panel-body"> <div class="row"> <div class="col-md-2"> <ul class="nav nav-pills nav-stacked"> <?php wp_list_categories('orderby=name&title_li'); ?> </ul> </div> <div class="col-md-10"> <?php while (have_posts()):the_post(); ?> <h3><a href="<?php the_permalink(); ?>" ><?php the_title(); ?></a></h3> <p><?php the_excerpt(); ?></p> <p>Post by <?php the_author(); ?>r on <?php the_time(); ?></p> <?php endwhile; wp_reset_query(); ?> </div> </div> </div> -Lấy nội dung bài post <div class="row"> <div class="col-md-9"> <div class="panel panel-default panel-body"> <?php while (have_posts()):the_post(); ?> <h3><a href="<?php the_permalink(); ?>" ><?php the_title(); ?></a></h3> <p class="text-muted">Post by <?php the_author(); ?> on <?php the_time(); ?></p> <p><?php the_content(); ?></p> <?php endwhile; wp_reset_query(); ?> </div> </div> </div> [...]... which case an empty string is returned 2.14 Sử dụng WP_Query để lấy bài post theo ý muốn WP_Query Arguments Default Usage . HÀM TRONG WORDPRESS 2.1 bloginfo($show); Description Displays information about your site, mostly gathered from the information you supply in your User Profile and General Settings WordPress. parameter always echoes "UTF-8", which is the default encoding of WordPress. 'version' - Displays the WordPress Version you use. This data is retrieved from the $wp_version. 'text_direction' - Displays the Text Direction of WordPress HTML pages. Consider using is_rtl() instead. 'language' - Displays the language of WordPress. 'stylesheet_url' - Displays
Ngày đăng: 06/05/2014, 13:55
Xem thêm: Wordpress tutorial, Wordpress tutorial, Chương 2. MỘT SỐ HÀM TRONG WORDPRESS, 14 Sử dụng WP_Query để lấy bài post theo ý muốn., Chương 3. Một số kiến thức rút ra từ dự án web chia sẻ tài liệu, 1 Mỗi trang trong wordpress đều có chức năng riêng., 2 Một số điều cần chú ý khi tạo theme cá nhân.