Wordpress tutorial

54 494 0
Wordpress tutorial

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

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

Từ khóa liên quan

Mục lục

  • Chương 1. WORDPRESS INTRODUCTION

    • 1.1 1.Một số hàm và đoạn code quan trọng.

    • Chương 2. MỘT SỐ HÀM TRONG WORDPRESS

      • 2.1 bloginfo($show);

      • 2.2 wp_list_pages($args);

      • 2.3  wp_list_categories( $args );

      • 2.4 have_posts(); 

      • 2.5 the_permalink(); 

      • 2.6 the_title( $before, $after, $echo ); 

      • 2.7 the_author(); 

      • 2.8 the_excerpt(); 

      • 2.9 the_content( $more_link_text, $stripteaser ); 

      • 2.10 previous_post_link();

      • 2.11 next_posts_link( $label , $max_pages ); 

      • 2.12 the_category( $separator, $parents, $post_id ); 

      • 2.13 get_post_meta( $post_id, $key, $single ); 

      • 2.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

        • 3.1 Mỗi trang trong wordpress đều có chức năng riêng.

          • 3.1.1 Index.php

          • 3.1.2 404.php

          • 3.1.3 archive.php

          • 3.1.4 author.php

          • 3.1.5 category.php

Tài liệu cùng người dùng

Tài liệu liên quan