Skip to content

Instantly share code, notes, and snippets.

@codersaiful
Created January 30, 2023 11:09
Show Gist options
  • Save codersaiful/602e4721bf0a3449411470d62e213bf1 to your computer and use it in GitHub Desktop.
Save codersaiful/602e4721bf0a3449411470d62e213bf1 to your computer and use it in GitHub Desktop.
<?php
add_filter('woocommerce_product_loop_start','__return_false');
add_filter('woocommerce_product_loop_end','__return_false');
add_filter('wc_get_template_part',function($template, $slug, $name){
// var_dump($template, $slug, $name);
if($slug === 'content' && $name === 'product') return false;
return $template;
}, 10, 3);
remove_action('woocommerce_before_shop_loop','wc_setup_loop');
add_action('woocommerce_before_shop_loop','ca_wpt_custom_shoppage_table_temp', 35);
function ca_wpt_custom_shoppage_table_temp(){
$config = get_option( 'wpt_configure_options' );
$table_id = isset( $config['archive_table_id'] ) ? $config['archive_table_id'] : false;
$table_id = apply_filters( 'wpto_default_archive_table_id', $table_id );
$table_id = is_numeric( $table_id ) ? (int) $table_id : false;
$id = get_queried_object_id();
$taxo_table_id = get_term_meta( $id, 'table_id', true );
if( ! empty( $taxo_table_id ) && is_numeric( $taxo_table_id ) ){
$table_id = $taxo_table_id;
}
if( $table_id ){
echo do_shortcode( "[Product_Table id='{$table_id}']" );
}
// var_dump($config);
// echo "Hello World";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment