woocommerce + storefront - 在主页 hooks/actions 之间添加自定义字段
woocomerce + storefront - add custom field between hooks/actions on homepage
我想在店面主页上的操作之间重新排序并添加我自己的代码。我知道如何 add/reorder 操作,但我不知道如何添加我自己的代码。
function storefront_child_reorder_homepage_contant() {
remove_action('homepage', 'storefront_homepage_content', 10 );
remove_action('homepage', 'storefront_product_categories', 20 );
remove_action('homepage', 'storefront_recent_products', 30 );
remove_action('homepage', 'storefront_featured_products', 40 );
remove_action('homepage', 'storefront_popular_products', 50 );
remove_action('homepage', 'storefront_on_sale_products', 60 );
remove_action('homepage', 'storefront_best_selling_products', 70 );
add_action('homepage', 'storefront_best_selling_products', 10 );
**<--- HERE I WANT TO ADD MY OWN PHP CODE (ADVANCED CUSTOM FIELD GALLERY FIELD)**
add_action('homepage', 'storefront_recent_products', 30 );
}
add_action('init', 'storefront_child_reorder_homepage_contant');
如你所见,我想要:
1.畅销产品2. ACF画廊 3. 近期产品
如何添加我的自定义代码以生成畅销产品和最新产品之间的图库?
好的,我刚刚弄明白了:
function storefront_child_add_custom_php() {
PHP CODE HERE
}
function storefront_child_reorder_homepage_contant() {
remove_action('homepage', 'storefront_homepage_content', 10 );
remove_action('homepage', 'storefront_product_categories', 20 );
remove_action('homepage', 'storefront_recent_products', 30 );
remove_action('homepage', 'storefront_featured_products', 40 );
remove_action('homepage', 'storefront_popular_products', 50 );
remove_action('homepage', 'storefront_on_sale_products', 60 );
remove_action('homepage', 'storefront_best_selling_products', 70 );
add_action('homepage', 'storefront_best_selling_products', 10 );
add_action('homepage', ' storefront_child_add_custom_php', 20 );
add_action('homepage', 'storefront_recent_products', 30 );
}
add_action('init', 'storefront_child_reorder_homepage_contant');
我想在店面主页上的操作之间重新排序并添加我自己的代码。我知道如何 add/reorder 操作,但我不知道如何添加我自己的代码。
function storefront_child_reorder_homepage_contant() {
remove_action('homepage', 'storefront_homepage_content', 10 );
remove_action('homepage', 'storefront_product_categories', 20 );
remove_action('homepage', 'storefront_recent_products', 30 );
remove_action('homepage', 'storefront_featured_products', 40 );
remove_action('homepage', 'storefront_popular_products', 50 );
remove_action('homepage', 'storefront_on_sale_products', 60 );
remove_action('homepage', 'storefront_best_selling_products', 70 );
add_action('homepage', 'storefront_best_selling_products', 10 );
**<--- HERE I WANT TO ADD MY OWN PHP CODE (ADVANCED CUSTOM FIELD GALLERY FIELD)**
add_action('homepage', 'storefront_recent_products', 30 );
}
add_action('init', 'storefront_child_reorder_homepage_contant');
如你所见,我想要: 1.畅销产品2. ACF画廊 3. 近期产品
如何添加我的自定义代码以生成畅销产品和最新产品之间的图库?
好的,我刚刚弄明白了:
function storefront_child_add_custom_php() {
PHP CODE HERE
}
function storefront_child_reorder_homepage_contant() {
remove_action('homepage', 'storefront_homepage_content', 10 );
remove_action('homepage', 'storefront_product_categories', 20 );
remove_action('homepage', 'storefront_recent_products', 30 );
remove_action('homepage', 'storefront_featured_products', 40 );
remove_action('homepage', 'storefront_popular_products', 50 );
remove_action('homepage', 'storefront_on_sale_products', 60 );
remove_action('homepage', 'storefront_best_selling_products', 70 );
add_action('homepage', 'storefront_best_selling_products', 10 );
add_action('homepage', ' storefront_child_add_custom_php', 20 );
add_action('homepage', 'storefront_recent_products', 30 );
}
add_action('init', 'storefront_child_reorder_homepage_contant');