Überschreiben Sie die function im übergeordneten Themen-Shortcode Avada

Ich benutze Avada als meine Eltern sie und ich versuche, die Fusion-faq.php-Datei zu überschreiben, so dass ich einige Anpassungen daran vornehmen kann. Ich habe versucht, den Shortcode ohne Glück zu überschreiben und versuche gerade, die function innerhalb dieser Datei zu überschreiben. Ich versuche speziell, die $html Variable neu zu schreiben, damit ich einige zusätzliche classn einschließen kann.

Fusion-FAQ.php:

  fusion_builder_default_visibility('string'), 'class' => '', 'id' => '', 'cats_slug' => '', 'exclude_cats' => '', 'featured_image' => $fusion_settings->get('faq_featured_image'), 'filters' => $fusion_settings->get('faq_filters'), ), $args ); $defaults['cat_slugs'] = $defaults['cats_slug']; // @codingStandardsIgnoreLine extract($defaults); self::$args = $defaults; // Transform $cat_slugs to array. if ($cat_slugs) { $cat_slugs = preg_replace('/\s+/', '', $cat_slugs); $cat_slugs = explode(',', $cat_slugs); } else { $cat_slugs = array(); } // Transform $cats_to_exclude to array. if ($exclude_cats) { $cats_to_exclude = preg_replace('/\s+/', '', $exclude_cats); $cats_to_exclude = explode(',', $cats_to_exclude); } else { $cats_to_exclude = array(); } // Initialize the query array. $args = array( 'post_type' => 'avada_faq', 'posts_per_page' => -1, 'has_password' => false, ); // Check if the are categories that should be excluded. if (!empty($cats_to_exclude)) { // Exclude the correct cats from tax_query. $args['tax_query'] = array( array( 'taxonomy' => 'faq_category', 'field' => 'slug', 'terms' => $cats_to_exclude, 'operator' => 'NOT IN', ), ); // Include the correct cats in tax_query. if (!empty($cat_slugs)) { $args['tax_query']['relation'] = 'AND'; $args['tax_query'][] = array( 'taxonomy' => 'faq_category', 'field' => 'slug', 'terms' => $cat_slugs, 'operator' => 'IN', ); } } else { // Include the cats from $cat_slugs in tax_query. if (!empty($cat_slugs)) { $args['tax_query'] = array( array( 'taxonomy' => 'faq_category', 'field' => 'slug', 'terms' => $cat_slugs, ), ); } } $class = fusion_builder_visibility_atts($hide_on_mobile, $class); $html = '
'; // Setup the filters. $faq_terms = get_terms('faq_category'); // Check if we should display filters. if ($faq_terms && 'no' !== $filters) { $html .= '
    '; // Check if the "All" filter should be displayed. $first_filter = true; if ('yes' === $filters) { $html .= '
  • '; $html .= '' . apply_filters('fusion_faq_all_filter_name', esc_html__('All', 'fusion-core')) . ''; $html .= '
  • '; $first_filter = false; } // Loop through the terms to setup all filters. foreach ($faq_terms as $faq_term) { // Only display filters of non excluded categories. if (!in_array($faq_term->slug, $cats_to_exclude, true)) { // Check if current term is part of chosen terms, or if no terms at all have been chosen. if ((!empty($cat_slugs) && in_array($faq_term->slug, $cat_slugs, true)) || empty($cat_slugs)) { // If the "All" filter is disabled, set the first real filter as active. if ($first_filter) { $html .= '
  • '; $html .= 'slug) . '" href="#">' . $faq_term->name . ''; $html .= '
  • '; $first_filter = false; } else { $html .= '
  • '; $html .= 'slug) . '" href="#">' . $faq_term->name . ''; $html .= '
  • '; } } } } $html .= '
'; } // End if(). // Setup the posts. $faq_items = fusion_cached_query($args); if (!$faq_items->have_posts()) { return fusion_builder_placeholder('avada_faq', 'FAQ posts'); } $html .= '
'; $html .= '
'; $html .= '
faq_counter . '">'; $this_post_id = get_the_ID(); while ($faq_items->have_posts()): $faq_items->the_post(); // If used on a faq item itself, thzis is needed to prevent an infinite loop. if (get_the_ID() === $this_post_id) { continue; } // Get all terms of the post and it as classes; needed for filtering. $post_classes = ''; $post_id = get_the_ID(); $post_terms = get_the_terms($post_id, 'faq_category'); if ($post_terms) { foreach ($post_terms as $post_term) { $post_classes .= urldecode($post_term->slug) . ' '; } } $html .= '
'; // Get the rich snippets for the post. $html .= avada_render_rich_snippets_for_pages(); $html .= ''; $html .= '
faq_counter . '-' . $post_id . '" class="panel-collapse collapse">'; $html .= '
'; $html .= '
'; // Render the featured image of the post. if (('1' === $featured_image || 'yes' === $featured_image) && has_post_thumbnail()) { $featured_image_src = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); if ($featured_image_src[0]) { $html .= '
'; $html .= ''; $html .= '
'; } } ob_start(); the_content(); $html .= ob_get_clean(); $html .= '
'; $html .= '
'; $html .= '
'; $html .= '
'; //Read More endwhile; // Loop through faq_items. wp_reset_postdata(); $html .= '
'; $html .= '
'; $html .= '
'; $html .= '
'; $this->faq_counter++; return $html; } /** * Gets the query arguments. * * @access private * @since 1.0 * @param array $term_slugs The term slugs. * @param array $terms_to_exclude The terms we wish to exclude. */ private function get_query_args($term_slugs, $terms_to_exclude) { } /** * Adds settings to element options panel. * * @access public * @since 1.1 * @return array $sections FAQ settings. */ public function add_options() { if (!class_exists('Fusion_Settings')) { return; } $option_name = Fusion_Settings::get_option_name(); return array( 'faq_shortcode_section' => array( 'label' => esc_html__('FAQ Element', 'fusion-core'), 'description' => '', 'id' => 'faq_shortcode_section', 'type' => 'sub-section', 'fields' => array( 'faq_featured_image' => array( 'label' => esc_html__('FAQ Featured Images', 'fusion-core'), 'description' => esc_html__('Turn on to display featured images.', 'fusion-core'), 'id' => 'faq_featured_image', 'default' => '0', 'type' => 'switch', 'option_name' => $option_name, ), 'faq_filters' => array( 'label' => esc_html__('FAQ Filters', 'fusion-core'), 'description' => esc_html__('Controls how the filters display for FAQs.', 'fusion-core'), 'id' => 'faq_filters', 'default' => 'yes', 'type' => 'radio-buttonset', 'choices' => array( 'yes' => esc_html__('Show', 'fusion-core'), 'yes_without_all' => esc_html__('Show without "All"', 'fusion-core'), 'no' => esc_html__('Hide', 'fusion-core'), ), 'option_name' => $option_name, ), ), ), ); } /** * Builds the dynamic styling. * * @access public * @since 3.1 * @return array */ public function add_styling() { global $wp_version, $content_media_query, $six_fourty_media_query, $three_twenty_six_fourty_media_query, $ipad_portrait_media_query, $fusion_settings, $fusion_library; $css['global']['.fusion-filters .fusion-filter.fusion-active a']['color'] = $fusion_library->sanitize->color($fusion_settings->get('primary_color')); $css['global']['.fusion-filters .fusion-filter.fusion-active a']['border-color'] = $fusion_library->sanitize->color($fusion_settings->get('primary_color')); $css[$content_media_query]['.fusion-filters']['border-bottom'] = '0'; $css[$content_media_query]['.fusion-filter']['float'] = 'none'; $css[$content_media_query]['.fusion-filter']['margin'] = '0'; $css[$content_media_query]['.fusion-filter']['border-bottom'] = '1px solid #E7E6E6'; return $css; } /** * Sets the necessary scripts. * * @access public * @since 3.1 * @return void */ public function add_scripts() { Fusion_Dynamic_JS::enqueue_script( 'avada-faqs', FusionCore_Plugin::$js_folder_url . '/avada-faqs.js', FusionCore_Plugin::$js_folder_path . '/avada-faqs.js', array('jquery', 'isotope', 'jquery-infinite-scroll'), '1', true ); } } } // End if(). new FusionSC_Faq(); } // End if(). add_action('wp_loaded', 'fusion_element_faq');

Kind Thema function.php:

 if ( ! function_exists ( 'fusion_faq' ) ) { remove_action( 'init', 'render' ); function custom($args, $content = '') { var_dump('XD2'); $html = '

I DID IT

'; var_dump('XD2'); // Setup the filters. $faq_terms = get_terms('faq_category'); // Check if we should display filters. if ($faq_terms && 'no' !== $filters) { $html .= '
    '; // Check if the "All" filter should be displayed. $first_filter = true; if ('yes' === $filters) { $html .= '
  • '; $html .= '' . apply_filters('fusion_faq_all_filter_name', esc_html__('All', 'fusion-core')) . ''; $html .= '
  • '; $first_filter = false; } // Loop through the terms to setup all filters. foreach ($faq_terms as $faq_term) { // Only display filters of non excluded categories. if (!in_array($faq_term->slug, $cats_to_exclude, true)) { // Check if current term is part of chosen terms, or if no terms at all have been chosen. if ((!empty($cat_slugs) && in_array($faq_term->slug, $cat_slugs, true)) || empty($cat_slugs)) { // If the "All" filter is disabled, set the first real filter as active. if ($first_filter) { $html .= '
  • '; $html .= 'slug) . '" href="#">' . $faq_term->name . ''; $html .= '
  • '; $first_filter = false; } else { $html .= '
  • '; $html .= 'slug) . '" href="#">' . $faq_term->name . ''; $html .= '
  • '; } } } } $html .= '
'; } // End if(). // Setup the posts. $faq_items = fusion_cached_query($args); if (!$faq_items->have_posts()) { return fusion_builder_placeholder('avada_faq', 'FAQ posts'); } $html .= '
'; $html .= '
'; $html .= '
faq_counter . '">'; $this_post_id = get_the_ID(); while ($faq_items->have_posts()): $faq_items->the_post(); // If used on a faq item itself, thzis is needed to prevent an infinite loop. if (get_the_ID() === $this_post_id) { continue; } // Get all terms of the post and it as classes; needed for filtering. $post_classes = ''; $post_id = get_the_ID(); $post_terms = get_the_terms($post_id, 'faq_category'); if ($post_terms) { foreach ($post_terms as $post_term) { $post_classes .= urldecode($post_term->slug) . ' '; } } $html .= '
'; // Get the rich snippets for the post. $html .= avada_render_rich_snippets_for_pages(); $html .= ''; $html .= '
faq_counter . '-' . $post_id . '" class="panel-collapse collapse">'; $html .= '
'; $html .= '
'; // Render the featured image of the post. if (('1' === $featured_image || 'yes' === $featured_image) && has_post_thumbnail()) { $featured_image_src = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); if ($featured_image_src[0]) { $html .= '
'; $html .= ''; $html .= '
'; } } ob_start(); the_content(); $html .= ob_get_clean(); $html .= '
'; $html .= '
'; $html .= '
'; $html .= '
'; //Read More endwhile; // Loop through faq_items. wp_reset_postdata(); $html .= '
'; $html .= '
'; $html .= '
'; $html .= '
'; $this->faq_counter++; return $html; } add_action( 'init', 'custom' ); } //Past attempts // add_action( 'init', 'remove_my_shortcodes',20 ); // function remove_my_shortcodes() { // remove_shortcode('fusion_faq'); // add_shortcode( 'fusion_faq', 'custom' ); // }

Solutions Collecting From Web of "Überschreiben Sie die function im übergeordneten Themen-Shortcode Avada"