-
AuthorPosts
-
September 26, 2022 at 2:47 pm #1366372
Hi,
i found code in an a older version of an child themes functions.php.
Although i researched and cleared a lot by my own these snippets are unclear.Are they still necessary / in charge or can they be removed because they are not valid/deprecated?
add_filter('avf_form_use_wpmail', 'avia_change_php_mail', 10, 3); function avia_change_php_mail($active, $new_post, $form_params){ return true; }
add_theme_support('avia_template_builder_custom_css');
//entfernt den Kommentarblock und die Datumsangaben aus dem Combo Widget // class avia_combo_widget extends WP_Widget { function avia_combo_widget() { //Constructor $widget_ops = array('classname' => 'avia_combo_widget', 'description' => 'A widget that displays your popular posts, recent posts, recent comments and a tagcloud' ); $this->WP_Widget( 'avia_combo_widget', THEMENAME.' Combo Widget', $widget_ops ); } function widget($args, $instance) { // prints the widget extract($args, EXTR_SKIP); $posts = empty($instance['count']) ? 4 : $instance['count']; echo $before_widget; echo "<div class='tabcontainer border_tabs top_tab tab_initial_open tab_initial_open__1'>"; echo '<div class="tab first_tab active_tab widget_tab_popular"><span>'.__('Popular', 'avia_framework').'</span></div>'; echo "<div class='tab_content active_tab_content'>"; avia_get_post_list('cat=&orderby=comment_count&posts_per_page='.$posts); echo "</div>"; echo '<div class="tab widget_tab_recent"><span>'.__('Recent', 'avia_framework').'</span></div>'; echo "<div class='tab_content'>"; avia_get_post_list('showposts='. $posts .'&orderby=post_date&order=desc'); echo "</div>"; echo '<div class="tab last_tab widget_tab_tags"><span>'.__('Tags', 'avia_framework').'</span></div>'; echo "<div class='tab_content tagcloud'>"; wp_tag_cloud('smallest=12&largest=12&unit=px'); echo "</div>"; echo "</div>"; echo $after_widget; } function update($new_instance, $old_instance) { $instance = $old_instance; foreach($new_instance as $key=>$value) { $instance[$key] = strip_tags($new_instance[$key]); } return $instance; } function form($instance) { //widgetform in backend $instance = wp_parse_args( (array) $instance, array('count' => 4) ); if(!is_numeric($instance['count'])) $instance['count'] = 4; ?> <p> <label for="<?php echo $this->get_field_id('count'); ?>">Number of posts you want to display: <input class="widefat" id="<?php echo $this->get_field_id('count'); ?>" name="<?php echo $this->get_field_name('count'); ?>" type="text" value="<?php echo esc_attr($instance['count']); ?>" /></label></p> <?php } } function avia_get_post_list( $avia_new_query , $excerpt = false) { global $avia_config; $image_size = isset($avia_config['widget_image_size']) ? $avia_config['widget_image_size'] : 'widget'; $additional_loop = new WP_Query($avia_new_query); if($additional_loop->have_posts()) : echo '<ul class="news-wrap">'; while ($additional_loop->have_posts()) : $additional_loop->the_post(); $format = ""; if(get_post_type() != 'post') $format = get_post_type(); if(empty($format)) $format = get_post_format(); if(empty($format)) $format = 'standard'; echo '<li class="news-content post-format-'.$format.'">'; //check for preview images: $image = ""; if(!current_theme_supports('force-post-thumbnails-in-widget')) { $slides = avia_post_meta(get_the_ID(), 'slideshow'); if( $slides != "" && !empty( $slides[0]['slideshow_image'] ) ) { $image = avia_image_by_id($slides[0]['slideshow_image'], 'widget', 'image'); } } if(!$image && current_theme_supports( 'post-thumbnails' )) { $image = get_the_post_thumbnail( get_the_ID(), $image_size ); } $time_format = apply_filters( 'avia_widget_time', get_option('date_format')." - ".get_option('time_format'), 'avia_get_post_list' ); $nothumb = (!$image) ? 'no-news-thumb' : ''; echo "<a class='news-link' title='".get_the_title()."' href='".get_permalink()."'>"; echo "<span class='news-thumb $nothumb'>"; echo $image; echo "</span>"; echo "<strong class='news-headline'>".avia_backend_truncate(get_the_title(), 55," "); //echo "<span class='news-time'>".get_the_time($time_format)."</span>"; echo "</strong>"; echo "</a>"; if('display title and excerpt' == $excerpt) { echo "<div class='news-excerpt'>"; the_excerpt(); echo "</div>"; } echo '</li>'; endwhile; echo "</ul>"; wp_reset_postdata(); endif; }
add_filter('avf_debugging_info', 'remove_debugging_info', $info); function remove_debugging_info($info) { $info = ''; return $info; }
kind regards
evaSeptember 27, 2022 at 10:23 am #1366497Hey evas49,
Thank you for the inquiry.
The theme defaults to wp_mail so the avf_form_use_wpmail filter above is not really necessary. Removing the filter should not affect the forms.
Best regards,
IsmaelSeptember 28, 2022 at 4:23 pm #1366745There have been much more codes i asked about
September 29, 2022 at 5:34 pm #1366955Hi,
You can also remove following one as it is enabled by default now
add_theme_support('avia_template_builder_custom_css');
If you would like to disable them, you can do so in Enfold theme options > Layout Builder > Hide Advanced Layout Builder Developer Options.
Others can stay :)
Best regards,
YigitOctober 4, 2022 at 10:57 am #1367544“Others can stay :)”
Hi, i didnt ask if they “can stay”.
I asked if they “have to stay”
Big difference.Eva
October 4, 2022 at 12:44 pm #1367561Hi,
can they be removed because they are not valid/deprecated?
But let us not focus on that Max
We have already told you the deprecated/unnecessary ones as you asked. You are the user/developer of your site. Do you still need to remove the comment block and dates from the combo widget? If so, keep the rest of the code. If not, delete it as well. Simple as that.
Best regards,
Yigit -
AuthorPosts
- The topic ‘Old code in my functions.php – actual or not?’ is closed to new replies.