Chuyên mục: Chia sẻ kinh nghiệm
Chia sẻ kinh nghiệm
Bạn backup lại theme đang sử dụng, folder uploads ( hình ảnh ), backup lại database ( các table _postmeta, _posts, _terms, _term_relationships, _term_taxonomy ) -> mục đích để xóa các table khác ví dụ: _options ( chứa nhiều thứ linh tinh mà mình khó kiểm soát được ).
Tiếp tục đọc
Chia sẻ kinh nghiệm
Hôm nay mình chỉ các bạn dùng code trang home đa ngôn ngữ <?php global $wp; $current_url = add_query_arg( $wp->query_string, ”, home_url( $wp->request ) ); echo $current_url.”&lang=en”; ?> Với lang=en Tiếng anh Lang=vi là tiếng việt
Tiếp tục đọc
Chia sẻ kinh nghiệm
Đầu tiên ta cài plugin WP-PageNavi Sau đó chép đoạn code sau vào function.php de nó hiển thị ra số <?php add_action( ‘wp_print_styles’, ‘my_deregister_styles’, 100 ); function my_deregister_styles() { wp_deregister_style( ‘wp-pagenavi’ ); } ?>
Tiếp tục đọc
Chia sẻ kinh nghiệm
Khi muốn lấy tiêu đề bài viết hay bất kỳ cái gì của bài viết hiện tại để đưa vào contact form ta cài thêm plugin contact form dynamic text extension sau khi cài vô xong ta dùng 1 field type là dynamic text CF7_get_post_var key=’post_title’ Muốn lấy giá trị từ form dùng phương thức post thì ta …
Tiếp tục đọc
Chia sẻ kinh nghiệm
<script type=”text/javascript”> var templateUrl = ‘<?= get_bloginfo(“template_url”); ?>’; </script> cái var templateUrl = ‘<?= get_bloginfo(“template_url”); ?>’; là để lấy đường dẫn của file từ theme wordpress Reset.style.background = ” url(‘”+templateUrl+”/images/searchfield_clear.png’) “;
Tiếp tục đọc
Chia sẻ kinh nghiệm
Khi sử dụng wordpress bạn cần thêm 1 số class cho mọi hình mình tải lên trang wordpress sau đâu là đoạn code giúp bạn làm điều đó // thêm class cho cai hinh function wpc_add_image_responsive_class( $html ){ $classes = ‘img-responsive‘; // separated by spaces, e.g. ‘img image-link’ // check if there are already classes assigned to the anchor …
Tiếp tục đọc
Chia sẻ kinh nghiệm
Đầu tiên ta phải tải các file .ttf hoặc .wof nói chung là các phải của font sau đó ta lưu trong thư mục fonts của theme cần import sau đó bỏ các đoạn css này vào file style.css @font-face { font-family: ‘helveticaneue’; src:url(../font/helveticaneue.ttf); font-weight: normal; font-style: normal; } Sau đó khi gọi ra ta dùng cách như sau …
Tiếp tục đọc
Chia sẻ kinh nghiệm
Khi bạn sử dụng plugin mega menu bạn cần bỏ cái border của nó.Mình sẽ giới thiệu các bạn đoạn css làm việc này #mega_main_menu.direction-horizontal > .menu_holder > .menu_inner > ul > li > .item_link:before, #mega_main_menu.direction-horizontal > .menu_holder > .menu_inner > .nav_logo:before, #mega_main_menu.direction-horizontal > .menu_holder > .menu_inner > ul > li.nav_search_box:before{background-image:none !important} Các bạn bỏ vào file style.css của theme …
Tiếp tục đọc
Chia sẻ kinh nghiệm
Bước 1 Bỏ hàm này vào file functions.php function getPostViews($postID){ $count_key = ‘post_views_count’; $count = get_post_meta($postID, $count_key, true); if($count==”){ delete_post_meta($postID, $count_key); add_post_meta($postID, $count_key, ‘0’); return “0 View”; } return $count.’ Views’; } function setPostViews($postID) { $count_key = ‘post_views_count’; $count = get_post_meta($postID, $count_key, true); if($count==”){ $count = 0; delete_post_meta($postID, $count_key); add_post_meta($postID, $count_key, ‘0’); }else{ $count++; update_post_meta($postID, $count_key, $count); } } …
Tiếp tục đọc
Chia sẻ kinh nghiệm
Khi bạn chuyển sang hosting mới mà server sài công nghệ quá cap chúng ta sẽ bị lỗi web do phiên bản php quá mới.Sau đây là cách khắc phục Khi host cập nhật phiên bản php mới 5.6 thì website của tôi đưa ra cảnh báo mysqli_real_connect(): Headers and client library minor version mismatch. Headers:100020 Library:100114 in /home/suck/public_html/wp-includes/wp-db.php on …
Tiếp tục đọc