-
AuthorPosts
-
September 19, 2023 at 10:59 am #1419551
Hello,
since the latest update, the following function no longer works and creates empty single product pages.function bt_woocommerce_overview_banner_image()
{
global $avia_config;
if(avia_is_dynamic_template() || is_paged() || is_search() ) return false;$image_size = “entry_with_sidebar”;
$layout = avia_layout_class( ‘main’ , false );
if($layout == ‘fullsize’) $image_size = ‘entry_without_sidebar’;if(is_shop())
{
$shop_id = function_exists( ‘wc_get_page_id’ ) ? wc_get_page_id( ‘shop’ ) : woocommerce_get_page_id( ‘shop’ );
if($shop_id != -1)
{
$image = get_the_post_thumbnail($shop_id, $image_size);
if($image) echo “<div class=’page-thumb’>{$image}</div>”;
}
}if(is_product_category())
{
global $wp_query;
$image = “”;
if(isset($wp_query->query_vars[‘taxonomy’]))
{
$term = get_term_by( ‘slug’, get_query_var($wp_query->query_vars[‘taxonomy’]), $wp_query->query_vars[‘taxonomy’]);if(!empty($term->term_id))
{
$attachment_id = get_woocommerce_term_meta($term->term_id, ‘thumbnail_id’);
$style = get_woocommerce_term_meta($term->term_id, ‘av_cat_styling’);if(!empty($attachment_id) && empty($style))
{
$image = wp_get_attachment_image( $attachment_id, ‘full’, false, array(‘class’=>’category_thumb’));
if($image) echo “{$image}”;
}}
}
}}
What can we use instead of this function?
Many greetingsSeptember 19, 2023 at 2:03 pm #1419572Please allways use the code tag here on board to post code snippets!
It is hard to read and to inspect only from text input.
Often errors occur if wrong quotation marks are set – but with text mode these are transfrered to slanted one – This particular source of error cannot therefore be properly assessed. etc.September 19, 2023 at 2:10 pm #1419574Hi,
Thank you for the inquiry.
Would you mind posting the code again on pastebin.com so that we can read it clearly, and provide a link to a product page? Looks like this is a modification for the shop or product banner. Do you remember what was added or modified in the function?
Best regards,
IsmaelSeptember 20, 2023 at 10:08 am #1419680Hi Ismael,
thank you for your answer.
I posted the function on pastebin.com and sent you the link to the Singple Product Page.
The function should change the order of the banner, category text and the products.
Best regards- This reply was modified 1 year, 2 months ago by marcfrey.
September 21, 2023 at 5:32 am #1419820Hi,
Thank you for the info.
The code in the pastebin.com looks incomplete, but we managed to find the error in the following line.
if(avia_is_dynamic_template() || is_paged() || is_search() ) return false;
The function avia_is_dynamic_template is no longer used in the theme. Please try to replace it with:
if(is_paged() || is_search() ) return false;
Best regards,
IsmaelSeptember 21, 2023 at 10:19 am #1419856Works great, thank you!
September 21, 2023 at 12:02 pm #1419883Hi,
Glad Ismael could help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.Best regards,
Mike -
AuthorPosts
- The topic ‘Function creates error after update’ is closed to new replies.