Category : Wordpress

Thêm chữ liên hệ với sản phẩm không nhập giá trong Woocommerce function filter_price_product(){ global $product; if($product->get_price()){ wc_get_template( ‘single-product/price.php’ ); } else{ echo ‘Liên hệ’; } remove_action(‘woocommerce_single_product_summary’,’woocommerce_template_single_price’,10); remove_action(‘woocommerce_after_shop_loop_item_title’,’woocommerce_template_loop_price’,10); add_action(‘woocommerce_after_shop_loop_item_title’,’filter_price_product’,11 ); add_action(‘woocommerce_single_product_summary’,’filter_price_product’,11); Hoặc function filter_woocommerce_empty_price_html( $var, $instance ) { return “Liên hệ”; }; add_filter( ‘woocommerce_empty_price_html’, ‘filter_woocommerce_empty_price_html’..

Read more

Sử dụng hàm paginate_links khi phân trang cho tùy chọn Danh mục trong wordpress $page = (get_query_var(‘page’)) ? get_query_var(‘page’) : 1; $getposts = new WP_Query(array( ‘post_type’=>’thietkekientruc’, ‘post_status’=>’publish’, ‘paged’=>$page, ‘posts_per_page’=>10)); while ($getposts->have_posts()) : $getposts->the_post(); // loop custom endwhile; endif; wp_reset_postdata(); wp_reset_query(); // Phân trang cho custom Query // $page = trang số $big = 999999999; echo paginate_links( ..

Read more