You can use a hook to override the templates. Thus, e.g. the previous standard template on a separate template.
Affiliate Toolkit provides several hooks for modifying the template, so you can use e.g. also print another template if no price should be available.
General function
This function is used with lists and products, so you can redirect the template in general.
1 2 3 4 5 6 7 |
function atkp_modifiy_template_callback( $template ) { //Vorlage hier übersteuern: //$template = 'wide'; return $template ; } add_filter( 'atkp_modify_template', 'atkp_modifiy_template_callback'); |
Parameter | Description |
template | Template-ID or Template-Name (if from the file system). |
Rückgabewert | The overridden template. |
Function for the list
This function is called only for a list. For example, due to conditions.
1 2 3 4 5 |
function atkp_modify_template_list_callback( $template, $id, $content ) { return $template ; } add_filter( 'atkp_modify_template_list', 'atkp_modify_template_list_callback'); |
Parameter | Description |
template | Vorlagen-ID oder Vorlagen-Name (wenn aus dem Dateisystem). |
id | The list-ID or the list-Name (depending on useage in Shortcode). |
content | The field “content” which is added to the shortcode. |
Return value | The overridden template. |
Function for the product
This function is only available for one product. With this, you can for example override the template due to conditions.
1 2 3 4 5 |
function atkp_modify_template_product_callback( $template, $id, $content ) { return $template ; } add_filter( 'atkp_modify_template_product', 'atkp_modify_template_product_callback'); |
Parameter | Description |
template | Vorlagen-ID oder Vorlagen-Name (wenn aus dem Dateisystem). |
id | The product-ID or the product-Name (depending on useage in Shortcode). |
content | The field “content” which is added to the shortcode. |
Return value | The overridden template. |
Tip: Use a plugin like My Custom Functions or a child theme to build your hooks!