Skip to content

Instantly share code, notes, and snippets.

View Thienlu99's full-sized avatar

Lê Thanh Thiên Thienlu99

View GitHub Profile
@Thienlu99
Thienlu99 / archivve
Created May 29, 2024 09:28
Xem thêm load more
<?php
get_header();
?>
<div class="bg--archive">
<section class="breadcum">
<div class="container">
<?php if (function_exists('rank_math_the_breadcrumbs')) rank_math_the_breadcrumbs(); ?>
</div>
@Thienlu99
Thienlu99 / gist:2ae16c9389f909ef4b6e62655ffe4cd3
Created May 15, 2024 04:01
giao diện form event và tỉnh thành
--------------tỉnh thành
<section class="category-section pb-4 mb-5">
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div class="single-content">
<h1><?php the_title(); ?></h1>
<div class="content-text">
<div class="chot-maps">
<div class="sidebar-map">
<a class="social-share-item hover-opacity-80 bg-social-zalo" href="https://zalo.me/share?url=<?php echo get_permalink($product->get_id()); ?>" rel="noopener noreferrer nofollow" target="_blank" aria-label="Chia sẻ qua Zalo">
<div class="share--single d-flex">
<a href="https://www.facebook.com/sharer.php?u=<?php echo get_permalink(); ?>" data-label="Facebook" onclick="window.open(this.href,this.title,'width=500,height=500,top=300px,left=300px'); return false;" rel="noopener noreferrer nofollow" target="_blank" aria-label="Chia sẻ trên Facebook">
<i class="fa-brands fa-facebook-f"></i>
</a>
<a href="https://twitter.com/share?url=<?php echo get_permalink(); ?>" data-label="Twitter" onclick="window.open(this.href,this.title,'width=500,height=500,top=300px,left=300px'); return false;" rel="noopener noreferrer nofollow" target="_blank" aria-label="Chia sẻ trên Twitter">
@Thienlu99
Thienlu99 / gist:9711b4378e17bcf25c91c15a648b687f
Created April 25, 2024 07:39
mẫu bài viết liên quan
<div class="lienquan--single">
<h3>Tin liên quan</h3>
<?php
$categories = get_the_category($post->ID);
if ($categories) {
$category_ids = array();
foreach ($categories as $individual_category) $category_ids[] = $individual_category->term_id;
$args = array(
'category__in' => $category_ids,
@Thienlu99
Thienlu99 / functions.php
Created April 21, 2024 07:46
xóa product hoặc san-pham tiền tố đi trong woo khi cài yosstseo
// thên .html product
/** Đoạn code thêm đuôi .html vào cuối sản phẩm **/
function codfe_product_permastruct_html($post_type, $args)
{
if ($post_type === 'product')
add_permastruct($post_type, "{$args->rewrite['slug']}/%$post_type%.html", $args->rewrite);
}
add_action('registered_post_type', 'codfe_product_permastruct_html', 10, 2);
//loại bỏ product
function devvn_remove_slug($post_link, $post)
@Thienlu99
Thienlu99 / cách 2
Created April 21, 2024 07:34
Thêm nút Mua ngay
cấu hình woocommerce\single-product\add-to-cart\simple.php
bỏ code add to cart bằng mua ngay
<button type="submit" name="buy-now" value="<?php echo esc_attr($product_id); ?>" class="single_add_to_cart_button button buy_now_button button alt<?php echo esc_attr(wc_wp_theme_get_element_class_name('button') ? ' ' . wc_wp_theme_get_element_class_name('button') : ''); ?>"><?php echo esc_html__('Mua ngay', 'your-text-domain'); ?></button>
<?php do_action('woocommerce_after_add_to_cart_button'); ?>
<?php else : ?>
<p><?php esc_html_e('Có lỗi xảy ra khi thêm sản phẩm vào giỏ hàng. Vui lòng thử lại sau.', 'your-text-domain'); ?></p>
<?php endif; ?>
@Thienlu99
Thienlu99 / card-product.php
Created April 7, 2024 14:05
hiện thị số sao, giá và phần trăm, biến thể, giá hiện tại
<div class="card-body">
<a href="<?php the_permalink(); ?>">
<p class="card-title "><?php echo the_title(); ?></p>
</a>
<div class="price-wrapper">
<div class="devvn_product_price">
<span class="price">
<?php
// Kiểm tra xem sản phẩm có phải là biến thể hay không
if ($product->is_type('variable')) {
@Thienlu99
Thienlu99 / core faeture.php
Created April 6, 2024 03:10
thêm cột nổi bật cho bài viết
<?php
class Featured_Post {
var $db = NULL;
public $post_types = array();
function __construct() {
add_action('init', array(&$this,
'init'
));
@Thienlu99
Thienlu99 / index.html
Created April 4, 2024 15:15
lấy bài viết nổi bật
<?php $args = array(
'post_type' => 'post',
'posts_per_page' => 10,
'post_status' => 'publish',
'meta_query' => array(
array(
'key' => '_is_featured',
'value' => 'yes'
)
)
@Thienlu99
Thienlu99 / compare.php
Created April 4, 2024 13:51
so sánh sản phẩm code thêm plugin compare
case 'price': // Đổi price thành trường bạn muốn hiển thị giá
// Thêm mã PHP để hiển thị giá ở đây
// Ví dụ:
$regular_price = $product->get_regular_price();
$sale_price = $product->get_sale_price();
if ($sale_price) {
$discount_percentage = (($regular_price - $sale_price) / $regular_price) * 100;
echo '<div class="d-flex justify-content-center align-items-center" > <span class="gia--cu"><del>' . wc_price($regular_price) . '</del></span>';
echo '<span class="km-pt" style="color: #e00;padding-left: 5px;">' . '-' . round($discount_percentage) . '%</span></div>';
echo '<span class="gia--moi" style=" display:block;margin-left:-35px;color: #e00;font-weight: 700;">' . wc_price($sale_price) . '</span>';