web-dev-qa-db-fra.com

Remplacement d'un fichier redux par thème dans un thème enfant

J'utilise un thème qui utilise le framework Redux pour les options de personnalisation. J'ai créé un thème enfant pour personnaliser ce thème. Dans le cadre du thème, je veux éditer l'un des fichiers. Pour ce faire, je pensais pouvoir copier le fichier dans mon thème enfant et le remplacer, mais il semble que non. Un peu de recherche indique que je peux utiliser un filtre dans mon fichier de fonctions pour le faire, mais je ne sais pas comment s'y prendre.

La section de code que je veux éditer ressemble à ceci et se trouve dans mon fichier customizer.php

    $this->sections[] = array(
  'title' => esc_html__('Footer', 'maverick-theme'),
  'desc' => esc_html__('Configure footer styles.', 'maverick-theme'),
  'subsection' => true,
  'fields' => array(
    array(
      'id'        => 'customizer-footer-bg-color',
      'type'      => 'color',
      'title'     => esc_html__('Background Color', 'maverick-theme'),
      'default'   => '',
      'output'    => array('background-color' => '#main-footer, #bottom-footer')
    ),
    array(
      'id'        => 'customizer-footer-social-color',
      'type'      => 'color',
      'title'     => esc_html__('Social Icon Color', 'maverick-theme'),
      'default'   => '',
      'output'    => array('color' => '#bottom-footer .social-icons li a')
    ),
    array(
      'id'        => 'customizer-footer-social-hover-color',
      'type'      => 'color',
      'title'     => esc_html__('Social Icon Hover Color', 'maverick-theme'),
      'default'   => '',
      'output'    => array('color' => '#bottom-footer .social-icons li a:hover i'),
      'important' => true
    ),
  ),
);

Merci beaucoup

2
caffeinehigh

Si vous devez ajouter les paramètres dans la section créée du thème parent, il vous suffit de placer le code ci-dessous dans le fichier child functions.php.

Mais n'oubliez pas de remplacer OPT Name par your_opt_name dans "OPT_NAME" (pour trouver OPT Name, ouvrez simplement /parent-theme/includes/options/options-config.php et en haut, une ligne $ opt_name = ' your_opt_name ';)

    function add_product_description($sections){

    $sections[10]['fields'][] = array(
                'id'        => 'product_extra_description',
                'type'      => 'multi_text',
                'title'     => __( 'Product Description', 'nm-framework-admin' ),
                'desc'      => __( 'Enter extra Product Description.', 'nm-framework-admin' ),
                'validate'  => 'html'
    );

    return $sections;
}
// In this example OPT_NAME is the returned opt_name.
//add_filter("redux/options/OPT_NAME/sections", 'add_another_section_bl');
add_filter("redux/options/OPT_NAME/sections", 'add_product_description');

De plus, dans les sections $ [10], vous devez remplacer par votre indexation. Et pour le trouver, vous devez imprimer la section $.

2
Zat Fo