私はこれが初めてで、少し助けが必要です。
これが変更したいサンプルコードです。h3タグをh5タグに交換したいです。
最初のページはこちら
<?php
/**
* woocommerce_before_subcategory_title hook
*
* @hooked woocommerce_subcategory_thumbnail - 10
*/
do_action( 'woocommerce_before_subcategory_title', $category );
?>
<h3>
<?php
echo $category->name;
if ( $category->count > 0 )
echo apply_filters( 'woocommerce_subcategory_count_html', ' <mark class="count">(' . $category->count . ')</mark>', $category );
?>
</h3>
<?php
/**
* woocommerce_after_subcategory_title hook
*/
do_action( 'woocommerce_after_subcategory_title', $category );
?>
コードのこの部分を置き換えようとしています:
<h3>
<?php
echo $category->name;
if ( $category->count > 0 )
echo apply_filters( 'woocommerce_subcategory_count_html', ' <mark class="count">(' . $category->count . ')</mark>', $category );
?>
</h3>
これとともに:
<div class="caption-non-move">
<h5>
<?php
echo $category->name;
if ( $category->count > 0 )
echo apply_filters( 'woocommerce_subcategory_count_html');
?>
</h5>
</div>
ここに私がこれまでに持っているものがあります。
<?php
// Add text to content-product-cat to help with styling
add_action('woocommerce_before_subcategory_title', 'woohook_before_subcategory_title');
function woohook_before_subcategory_title() {
ob_start();
}
add_action('woocommerce_after_subcategory_title', 'woohook_after_subcategory_title');
function woohook_after_subcategory_title() {
$subcategory_title = ob_get_clean();
echo "<div class='caption-non-move'>";
echo str_replace('h3>', 'h5>', $subcategory_title);
}
?>
そしてこれが2ページ目
<li <?php post_class( $classes ); ?>>
<?php do_action( 'woocommerce_before_shop_loop_item' ); ?>
<a href="<?php the_permalink(); ?>">
<?php
/**
* woocommerce_before_shop_loop_item_title hook
*
* @hooked woocommerce_show_product_loop_sale_flash - 10
* @hooked woocommerce_template_loop_product_thumbnail - 10
*/
do_action( 'woocommerce_before_shop_loop_item_title' );
?>
<h3><?php the_title(); ?></h3>
<?php
/**
* woocommerce_after_shop_loop_item_title hook
*
* @hooked woocommerce_template_loop_price - 10
*/
do_action( 'woocommerce_after_shop_loop_item_title' );
?>
</a>
<?php do_action( 'woocommerce_after_shop_loop_item' ); ?>
</li>
2 ページ目では、コードのこの部分を置き換えようとしています
<h3><?php the_title(); ?></h3>
と
<div class="caption"><h5><?php the_title(); ?></h5>
<div class="category-main-points"><?php echo apply_filters( 'woocommerce_short_description', $post->post_excerpt ) ?>
</div>
</div>
これが私がこれまでに2ページ目に持っているものです
<?php
// Add text to content-product-cat to help with styling
add_action('woocommerce_before_shop_loop_item_title', 'woohook_before_shop_loop_item_title');
function woohook_before_shop_loop_item_title() {
ob_start();
}
add_action('woocommerce_after_shop_loop_item_title', 'woohook_after_shop_loop_item_title');
function woohook_after_shop_loop_item_title() {
$doh_title = ob_get_clean();
echo "<div class='caption'>";
echo str_replace('h3>', 'h5>', $doh_title);
}
?>