Voglio riordinare e aggiungere il mio codice tra l'azione sulla home page di storefront. So come aggiungere / riordinare le azioni, ma non so come aggiungere il mio codice.
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");
Come puoi vedere voglio: 1. I prodotti più venduti 2. Galleria ACF 3. Prodotti recenti
Come aggiungere il mio codice personalizzato per generare una galleria tra i prodotti più venduti e recenti?
risposte:
1 per risposta № 1Ok, l'ho appena capito:
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");