Quero reordenar e adicionar meu próprio código entre a ação na home page da loja. Eu sei como adicionar / reordenar ações, mas não sei como adicionar meu próprio código.
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");
Como você pode ver eu quero: 1. produtos mais vendidos 2. galeria ACF 3. Produtos Recentes
Como adicionar meu código personalizado para gerar uma galeria entre produtos mais vendidos e recentes?
Respostas:
1 para resposta № 1Ok, eu acabei de descobrir:
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");