[Résolu] Remplacer carrousel d’image d’article par galerie

  • WordPress :4.9
  • Statut : résolu
7 sujets de 1 à 7 (sur un total de 7)
  • Auteur
    Messages
  • #2111052
    Livie2
    Participant
    Initié WordPress
    31 contributions

    Bonjour,

    Ma configuration WP actuelle

    • Version de PHP/MySQL :  7.1.7     5.6.37
    • Thème utilisé : oria
    • Extensions en place :  gallery by supstick
    • Nom de l’hébergeur :  local
    • Adresse du site :  J’ai un lien local que je peux partager mais je ne sais pas si c’est sécurisé pour moi.

    Problème(s) rencontré(s) :

    Bonsoir à tous, j’utilise le thème Oria dans lequel un carrousel des images misent en avant dans les articles sont affichés dans le header (voir pj).

    Je souhaiterai remplacer ces images par une galerie de photos que j’ai créée (via l’extension gallerie by supstick, donc juste un code php à insérer)

    Mais je n’y arrive pas toute seule, je test des choses à tâtons mais ça me met souvent tout mon site en erreur.

    Voici le code de mon slider.php qui contrôle le carrousel (enfin je croix)

     

    <?php
    /**
     * Carousel template
     *
     * @package Oria
     */
    
    	//Scripts
    	function oria_slider_scripts() {
    			wp_enqueue_script( 'oria-owl-script', get_template_directory_uri() .  '/js/owl.carousel.min.js', array( 'jquery' ), true );	
    			wp_enqueue_script( 'oria-slider-init', get_template_directory_uri() .  '/js/slider-init.js', array( 'jquery' ), true );
    			
    			//Slider speed options
    			if ( ! get_theme_mod('carousel_speed') ) {
    				$slideshowspeed = 4000;
    			} else {
    				$slideshowspeed = intval(get_theme_mod('carousel_speed'));
    			}			
    			$slider_options = array(
    				'slideshowspeed' => $slideshowspeed,
    			);			
    			wp_localize_script('oria-slider-init', 'sliderOptions', $slider_options);			
    	}
    	add_action( 'wp_enqueue_scripts', 'oria_slider_scripts' );
    
    	//Template
    	if ( ! function_exists( 'oria_slider_template' ) ) {
    		function oria_slider_template() {
    	       
    	       	//Get the user choices
    	        $number     = get_theme_mod('carousel_number');
    	        $cat        = get_theme_mod('carousel_cat');
    	        $number     = ( ! empty( $number ) ) ? intval( $number ) : 6;
    	        $cat        = ( ! empty( $cat ) ) ? intval( $cat ) : '';
    
    			$args = array(
    				'posts_per_page'		=> $number,
    				'post_status'   		=> 'publish',
    	            'cat'                   => $cat,
    	            'ignore_sticky_posts'   => true			
    			);
    			$query = new WP_Query( $args );	
    			if ( $query->have_posts() ) {
    			?>
    			<div class="oria-slider slider-loader">
    				<div class="featured-inner clearfix">
    					<div class="slider-inner">
    					<?php while ( $query->have_posts() ) : $query->the_post(); ?>
    						<div class="slide">
    							<?php if ( has_post_thumbnail() ) : ?>
    								<?php the_post_thumbnail( 'oria-carousel' ); ?>
    							<?php else : ?>
    								<?php echo '<img src="' . get_stylesheet_directory_uri() . '/images/placeholder.png"/>'; ?>
    							<?php endif; ?>
    							<?php the_title( sprintf( '<h3 class="slide-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h3>' ); ?>
    						</div>
    					<?php endwhile; ?>
    					</div>
    				</div>
    			</div>
    			<?php }
    			wp_reset_postdata();
    		}
    	}

     

     

    Voilà voilà je vous remercie d’avance, n’hésitez pas s’il vous faut d’autre informations !

    Bonne soirée

     

     

    #2111170
    PhiLyon
    Modérateur
    Maître WordPress
    19371 contributions

    Bonsoir.

    Tu n’arriveras pas à insérer ta galerie dans le carrousel d’origine du thème, pas sympa hein 😆

    Par contre si tu le désactives et que tu utilises le code d’insertion pour le php ça peut le faire.

    <?php echo do_shortcode('[supsystic-gallery id=1]') ?>

    Pour cela il faut que tu crées un thème enfant, dans ce thème enfant tu importes le fichier header.php et tu colles le code à la ligne 76. (ton code bien-sûr) comme ça

    </header><!-- #masthead -->
    	<?php echo do_shortcode('[supsystic-gallery id=1]') ?>
    	<?php if ( ( get_theme_mod('carousel_display_front') && is_front_page() ) || ( get_theme_mod('carousel_display_archives', '1') && ( is_home() || is_archive() ) ) || ( ( get_theme_mod('carousel_display_singular') && is_singular() ) ) ) : ?>

    🙂

    #2113769
    Livie2
    Participant
    Initié WordPress
    31 contributions

    Bonjour et heureuse de te revoir PhilLyon !

    J’avais déjà trouvé la première manip que tu me donne. Donc je pense que j’ai mal précisé ma question ^^

    Effectivement la galerie des post est bien remplacée par la galerie supstick mais du coup je n’ai pas le joli JS et la div qui vont avec et du coup ma galerie ne reste par horizontale mais va la ligne, elle n’est pas scrollable: screenshot avec la galerie par supstick et la galerie de base:

    https://zupimages.net/up/18/10/3w9j.jpg

    Autre chose, je ne comprends pas à quoi sert cette ligne de php que tu me donne: Que je la mettre ou pas j’obtient la même chose si jamais tu as le temps de m’expliquer =)

    <?php if ( ( get_theme_mod('carousel_display_front') && is_front_page() ) || ( get_theme_mod('carousel_display_archives', '1') && ( is_home() || is_archive() ) ) || ( ( get_theme_mod('carousel_display_singular') && is_singular() ) ) ) ; ?>

    Donc voila je voudrais au moins que ma galerie reste horizontale et n’aille pas à la ligne (donc dans une div ?) si tu peux me donner un coup de main, je vais déjà faire des essais moi même =)   Encore merci pour ton aide !

    #2113788
    Livie2
    Participant
    Initié WordPress
    31 contributions

    Donc voilà j’ai créé ma div dans le header ce qui me donne:

     

    </header><!-- #masthead -->
    	
    <div class="slider"> <?php echo do_shortcode('[supsystic-gallery id=2]') ?> </div>

    Et dans mon css:

     

    .slider {
    	position: relative;
    	width: 100%;
    	height: 50px;
    }

     

    Mais je n’ai toujours pas de scroll horizontal, voir screenshot, ma galerie va toujours à la ligne

    https://zupimages.net/up/18/10/drge.jpg

     

    Je sais pas trop ce que je dois ajouter au css pour faire cela =)

    #2113798
    Livie2
    Participant
    Initié WordPress
    31 contributions

    Yes, j’ai réussi =) (je créé encore un nouveau message car je ne peux plus éditer)

    Aller encore un questions ^^ Y a t-il un moyen de créer un JS ou de se re servir du JS existant pour que le scroll disparaisse pour avoir des jolies flêches à la place ?

    SCREEN

    https://zupimages.net/up/18/10/itid.jpg

    CSS

    .slider {
    	position: relative;
    	width: 100%;
    	height: 200px;
    	display: inline-block;
    	 overflow: auto;
    	  white-space: nowrap;
    }

     

    JS déja présent dans le thème

     

    <?php
    /**
     * Oria Theme Customizer
     *
     * @package Oria
     */
    
    /**
     * Add postMessage support for site title and description for the Theme Customizer.
     *
     * @param WP_Customize_Manager $wp_customize Theme Customizer object.
     */
    function oria_customize_register( $wp_customize ) {
    	$wp_customize->get_setting( 'blogname' )->transport         = 'postMessage';
    	$wp_customize->get_setting( 'blogdescription' )->transport  = 'postMessage';
    	$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
        $wp_customize->get_section( 'header_image' )->panel         = 'oria_header_panel';
        $wp_customize->get_section( 'title_tagline' )->priority     = '9';
        $wp_customize->get_section( 'title_tagline' )->title        = __('Site branding', 'oria');
        $wp_customize->get_section( 'title_tagline' )->panel        = 'oria_header_panel';
        $wp_customize->remove_control( 'header_textcolor' );
        $wp_customize->remove_control( 'display_header_text' );
    
        //Titles
        class Oria_Info extends WP_Customize_Control {
            public $type = 'info';
            public $label = '';
            public function render_content() {
            ?>
                <h3 style="margin-top:30px;border-bottom:1px solid;padding:5px;color:#111;text-transform:uppercase;"><?php echo esc_html( $this->label ); ?></h3>
            <?php
            }
        }
        //Categories dropdown control.
        class Oria_Categories_Dropdown extends WP_Customize_Control {
            public function render_content() {
                $dropdown = wp_dropdown_categories(
                    array(
                        'name'              => '_customize-dropdown-categories-' . $this->id,
                        'echo'              => 0,
                        'show_option_none'  => __( '— Select —', 'oria' ),
                        'option_none_value' => '0',
                        'selected'          => $this->value(),
                    )
                );
    
                $dropdown = str_replace( '<select', '<select ' . $this->get_link(), $dropdown );
    
                printf(
                    '<label class="customize-control-select"><span class="customize-control-title">%s</span> %s</label>',
                    $this->label,
                    $dropdown
                );
            }
        }
    
        //___General___//
        $wp_customize->add_section(
            'oria_general',
            array(
                'title' => __('General', 'oria'),
                'priority' => 9,
            )
        );
        //Favicon Upload
        $wp_customize->add_setting(
            'site_favicon',
            array(
                'default-image' => '',
                'sanitize_callback' => 'esc_url_raw',
            )
        );
        $wp_customize->add_control(
            new WP_Customize_Image_Control(
                $wp_customize,
                'site_favicon',
                array(
                   'label'          => __( 'Upload your favicon', 'oria' ),
                   'type'           => 'image',
                   'section'        => 'oria_general',
                   'settings'       => 'site_favicon',
                   'priority' => 10,
                )
            )
        );
        //Disable Preloader
        $wp_customize->add_setting(
            'oria_disable_preloader',
            array(
                'sanitize_callback' => 'oria_sanitize_checkbox',
            )
        );
        $wp_customize->add_control(
            'oria_disable_preloader',
            array(
                'type' => 'checkbox',
                'label' => esc_html__( 'Disable preloader?','oria' ),
                'section' => 'oria_general',
                'priority'    => 11,
            )
        );
        //___Header area___//
        $wp_customize->add_panel( 'oria_header_panel', array(
            'priority'       => 10,
            'capability'     => 'edit_theme_options',
            'theme_supports' => '',
            'title'          => __('Header area', 'oria'),
        ) );
        //Logo Upload
        $wp_customize->add_setting(
            'site_logo',
            array(
                'default-image' => '',
                'sanitize_callback' => 'esc_url_raw',
    
            )
        );
        $wp_customize->add_control(
            new WP_Customize_Image_Control(
                $wp_customize,
                'site_logo',
                array(
                   'label'          => __( 'Upload your logo', 'oria' ),
                   'type'           => 'image',
                   'section'        => 'title_tagline',
                   'settings'       => 'site_logo',
                   'priority'       => 11,
                )
            )
        );
        //Logo size
        $wp_customize->add_setting(
            'logo_size',
            array(
                'sanitize_callback' => 'absint',
                'default'           => '200',
                'transport'         => 'postMessage'
            )
        );
        $wp_customize->add_control( 'logo_size', array(
            'type'        => 'number',
            'priority'    => 12,
            'section'     => 'title_tagline',
            'label'       => __('Logo size', 'oria'),
            'description' => __('Max-width for the logo. Default 200px', 'oria'),
            'input_attrs' => array(
                'min'   => 50,
                'max'   => 600,
                'step'  => 5,
                'style' => 'margin-bottom: 15px; padding: 15px;',
            ),
        ) );
        //Logo style
        $wp_customize->add_setting(
            'logo_style',
            array(
                'default'           => 'hide-title',
                'sanitize_callback' => 'oria_sanitize_logo_style',
            )
        );
        $wp_customize->add_control(
            'logo_style',
            array(
                'type'          => 'radio',
                'label'         => __('Logo style', 'oria'),
                'description'   => __('This option applies only if you are using a logo', 'oria'),
                'section'       => 'title_tagline',
                'priority'      => 13,
                'choices'       => array(
                    'hide-title'  => __( 'Only logo', 'oria' ),
                    'show-title'  => __( 'Logo plus site title&description', 'oria' ),
                ),
            )
        );
        //Padding
        $wp_customize->add_setting(
            'branding_padding',
            array(
                'sanitize_callback' => 'absint',
                'default'           => '75',
            )
        );
        $wp_customize->add_control( 'branding_padding', array(
            'type'        => 'number',
            'priority'    => 14,
            'section'     => 'title_tagline',
            'label'       => __('Site branding padding', 'oria'),
            'description' => __('Top&bottom padding for the branding (logo, site title, description). Default: 75px', 'oria'),
            'input_attrs' => array(
                'min'   => 20,
                'max'   => 200,
                'step'  => 5,
                'style' => 'padding: 15px;',
            ),
        ) );
        //___Carousel___//
        $wp_customize->add_section(
            'oria_carousel',
            array(
                'title' => __('Carousel', 'oria'),
                'priority' => 13,
            )
        );
        //Display: Front page
        $wp_customize->add_setting(
            'carousel_display_front',
            array(
                'sanitize_callback' => 'oria_sanitize_checkbox',
                'default' => 0,
            )
        );
        $wp_customize->add_control(
            'carousel_display_front',
            array(
                'type' => 'checkbox',
                'label' => __('Show carousel on front page?', 'oria'),
                'section' => 'oria_carousel',
                'priority' => 8,
            )
        );
        //Display: Home and archives
        $wp_customize->add_setting(
            'carousel_display_archives',
            array(
                'sanitize_callback' => 'oria_sanitize_checkbox',
                'default' => 1,
            )
        );
        $wp_customize->add_control(
            'carousel_display_archives',
            array(
                'type' => 'checkbox',
                'label' => __('Show carousel on blog index/archives/etc?', 'oria'),
                'section' => 'oria_carousel',
                'priority' => 9,
            )
        );
        //Display: Singular
        $wp_customize->add_setting(
            'carousel_display_singular',
            array(
                'sanitize_callback' => 'oria_sanitize_checkbox',
                'default' => 0,
            )
        );
        $wp_customize->add_control(
            'carousel_display_singular',
            array(
                'type' => 'checkbox',
                'label' => __('Show carousel on single posts and pages?', 'oria'),
                'section' => 'oria_carousel',
                'priority' => 10,
            )
        );
        //Category
        $wp_customize->add_setting( 'carousel_cat', array(
            'default'           => '',
            'sanitize_callback' => 'absint',
        ) );
    
        $wp_customize->add_control( new oria_Categories_Dropdown( $wp_customize, 'carousel_cat', array(
            'label'     => __('Select which category to show in the carousel', 'oria'),
            'section'   => 'oria_carousel',
            'settings'  => 'carousel_cat',
            'priority'  => 11
        ) ) );
        //Autoplay speed
        $wp_customize->add_setting(
            'carousel_speed',
            array(
                'default'           => '4000',
                'sanitize_callback' => 'oria_sanitize_int',
            )
        );
        $wp_customize->add_control(
            'carousel_speed',
            array(
                'label'     => __('Enter the carousel speed in miliseconds [Default: 4000]', 'oria'),
                'section'   => 'oria_carousel',
                'type'      => 'text',
                'priority'  => 13
            )
        );
        //Number of posts
        $wp_customize->add_setting(
            'carousel_number',
            array(
                'default'           => '6',
                'sanitize_callback' => 'oria_sanitize_int',
            )
        );
        $wp_customize->add_control(
            'carousel_number',
            array(
                'label'     => __('Enter the number of posts you want to show', 'oria'),
                'section'   => 'oria_carousel',
                'type'      => 'text',
                'priority'  => 12
            )
        );
        //___Blog options___//
        $wp_customize->add_section(
            'blog_options',
            array(
                'title' => __('Blog options', 'oria'),
                'priority' => 13,
            )
        );
        // Blog layout
        $wp_customize->add_setting('oria_options[info]', array(
                'type'              => 'info_control',
                'capability'        => 'edit_theme_options',
                'sanitize_callback' => 'esc_attr',
            )
        );
        $wp_customize->add_control( new Oria_Info( $wp_customize, 'layout', array(
            'label' => __('Layout', 'oria'),
            'section' => 'blog_options',
            'settings' => 'oria_options[info]',
            'priority' => 10
            ) )
        );
        //Full width singles
        $wp_customize->add_setting(
            'fullwidth_single',
            array(
                'sanitize_callback' => 'oria_sanitize_checkbox',
            )
        );
        $wp_customize->add_control(
            'fullwidth_single',
            array(
                'type'      => 'checkbox',
                'label'     => __('Full width single posts?', 'oria'),
                'section'   => 'blog_options',
                'priority'  => 12,
            )
        );
        //Content/excerpt
        $wp_customize->add_setting('oria_options[info]', array(
                'type'              => 'info_control',
                'capability'        => 'edit_theme_options',
                'sanitize_callback' => 'esc_attr',
            )
        );
        $wp_customize->add_control( new Oria_Info( $wp_customize, 'content', array(
            'label' => __('Content/excerpt', 'oria'),
            'section' => 'blog_options',
            'settings' => 'oria_options[info]',
            'priority' => 13
            ) )
        );
        //Excerpt
        $wp_customize->add_setting(
            'exc_lenght',
            array(
                'sanitize_callback' => 'absint',
                'default'           => '35',
            )
        );
        $wp_customize->add_control( 'exc_lenght', array(
            'type'        => 'number',
            'priority'    => 16,
            'section'     => 'blog_options',
            'label'       => __('Excerpt lenght', 'oria'),
            'description' => __('Excerpt length [default: 35 words]', 'oria'),
            'input_attrs' => array(
                'min'   => 10,
                'max'   => 200,
                'step'  => 5,
                'style' => 'padding: 15px;',
            ),
        ) );
        //Read more
        $wp_customize->add_setting(
            'read_more_text',
            array(
                'default'           => __('Continue reading','oria'),
                'sanitize_callback' => 'oria_sanitize_text',
            )
        );
        $wp_customize->add_control(
            'read_more_text',
            array(
                'label'     => __('Enter the text for the Continue Reading button', 'oria'),
                'section'   => 'blog_options',
                'type'      => 'text',
                'priority'  => 17
            )
        );
        //Meta
        $wp_customize->add_setting('oria_options[info]', array(
                'type'              => 'info_control',
                'capability'        => 'edit_theme_options',
                'sanitize_callback' => 'esc_attr',
            )
        );
        $wp_customize->add_control( new Oria_Info( $wp_customize, 'meta', array(
            'label' => __('Meta', 'oria'),
            'section' => 'blog_options',
            'settings' => 'oria_options[info]',
            'priority' => 18
            ) )
        );
        //Hide meta index
        $wp_customize->add_setting(
          'hide_meta_index',
          array(
            'sanitize_callback' => 'oria_sanitize_checkbox',
            'default' => 0,
          )
        );
        $wp_customize->add_control(
          'hide_meta_index',
          array(
            'type' => 'checkbox',
            'label' => __('Hide post meta on index, archives?', 'oria'),
            'section' => 'blog_options',
            'priority' => 19,
          )
        );
        //Hide meta single
        $wp_customize->add_setting(
          'hide_meta_single',
          array(
            'sanitize_callback' => 'oria_sanitize_checkbox',
            'default' => 0,
          )
        );
        $wp_customize->add_control(
          'hide_meta_single',
          array(
            'type' => 'checkbox',
            'label' => __('Hide post meta on single posts?', 'oria'),
            'section' => 'blog_options',
            'priority' => 20,
          )
        );
        //Featured images
        $wp_customize->add_setting('oria_options[info]', array(
                'type'              => 'info_control',
                'capability'        => 'edit_theme_options',
                'sanitize_callback' => 'esc_attr',
            )
        );
        $wp_customize->add_control( new Oria_Info( $wp_customize, 'images', array(
            'label' => __('Featured images', 'oria'),
            'section' => 'blog_options',
            'settings' => 'oria_options[info]',
            'priority' => 21
            ) )
        );
        //Index images
        $wp_customize->add_setting(
            'index_feat_image',
            array(
                'sanitize_callback' => 'oria_sanitize_checkbox',
            )
        );
        $wp_customize->add_control(
            'index_feat_image',
            array(
                'type' => 'checkbox',
                'label' => __('Hide featured images on index, archives?', 'oria'),
                'section' => 'blog_options',
                'priority' => 22,
            )
        );
        //Post images
        $wp_customize->add_setting(
            'post_feat_image',
            array(
                'sanitize_callback' => 'oria_sanitize_checkbox',
            )
        );
        $wp_customize->add_control(
            'post_feat_image',
            array(
                'type' => 'checkbox',
                'label' => __('Hide featured images on single posts?', 'oria'),
                'section' => 'blog_options',
                'priority' => 23,
            )
        );
    
        //___Fonts___//
        $wp_customize->add_section(
            'oria_fonts',
            array(
                'title' => __('Fonts', 'oria'),
                'priority' => 15,
                'description' => __('You can use any Google Fonts you want for the heading and/or body. See the fonts here: google.com/fonts. See the documentation if you need help with this: flyfreemedia.com/documentation/oria', 'oria'),
            )
        );
        //Body fonts
        $wp_customize->add_setting(
            'body_font_name',
            array(
                'default' => 'Lato:400,700,400italic,700italic',
                'sanitize_callback' => 'oria_sanitize_text',
            )
        );
        $wp_customize->add_control(
            'body_font_name',
            array(
                'label' => __( 'Body font name/style/sets', 'oria' ),
                'section' => 'oria_fonts',
                'type' => 'text',
                'priority' => 11
            )
        );
        //Body fonts family
        $wp_customize->add_setting(
            'body_font_family',
            array(
                'default' => 'Lato, sans-serif',
                'sanitize_callback' => 'oria_sanitize_text',
            )
        );
        $wp_customize->add_control(
            'body_font_family',
            array(
                'label' => __( 'Body font family', 'oria' ),
                'section' => 'oria_fonts',
                'type' => 'text',
                'priority' => 12
            )
        );
        //Headings fonts
        $wp_customize->add_setting(
            'headings_font_name',
            array(
                'default' => 'Oswald:300,700',
                'sanitize_callback' => 'oria_sanitize_text',
            )
        );
        $wp_customize->add_control(
            'headings_font_name',
            array(
                'label' => __( 'Headings font name/style/sets', 'oria' ),
                'section' => 'oria_fonts',
                'type' => 'text',
                'priority' => 14
            )
        );
        //Headings fonts family
        $wp_customize->add_setting(
            'headings_font_family',
            array(
                'default' => 'Oswald, sans-serif',
                'sanitize_callback' => 'oria_sanitize_text',
            )
        );
        $wp_customize->add_control(
            'headings_font_family',
            array(
                'label' => __( 'Headings font family', 'oria' ),
                'section' => 'oria_fonts',
                'type' => 'text',
                'priority' => 15
            )
        );
        // Site title
        $wp_customize->add_setting(
            'site_title_size',
            array(
                'sanitize_callback' => 'absint',
                'default'           => '62',
                'transport'         => 'postMessage'
            )
        );
        $wp_customize->add_control( 'site_title_size', array(
            'type'        => 'number',
            'priority'    => 17,
            'section'     => 'oria_fonts',
            'label'       => __('Site title', 'oria'),
            'input_attrs' => array(
                'min'   => 10,
                'max'   => 90,
                'step'  => 1,
                'style' => 'margin-bottom: 15px; padding: 10px;',
            ),
        ) );
        // Site description
        $wp_customize->add_setting(
            'site_desc_size',
            array(
                'sanitize_callback' => 'absint',
                'default'           => '18',
                'transport'         => 'postMessage'
            )
        );
        $wp_customize->add_control( 'site_desc_size', array(
            'type'        => 'number',
            'priority'    => 17,
            'section'     => 'oria_fonts',
            'label'       => __('Site description', 'oria'),
            'input_attrs' => array(
                'min'   => 10,
                'max'   => 50,
                'step'  => 1,
                'style' => 'margin-bottom: 15px; padding: 10px;',
            ),
        ) );
        //H1 size
        $wp_customize->add_setting(
            'h1_size',
            array(
                'sanitize_callback' => 'absint',
                'default'           => '38',
            )
        );
        $wp_customize->add_control( 'h1_size', array(
            'type'        => 'number',
            'priority'    => 17,
            'section'     => 'oria_fonts',
            'label'       => __('H1 font size', 'oria'),
            'input_attrs' => array(
                'min'   => 10,
                'max'   => 60,
                'step'  => 1,
                'style' => 'margin-bottom: 15px; padding: 10px;',
            ),
        ) );
        //H2 size
        $wp_customize->add_setting(
            'h2_size',
            array(
                'sanitize_callback' => 'absint',
                'default'           => '30',
            )
        );
        $wp_customize->add_control( 'h2_size', array(
            'type'        => 'number',
            'priority'    => 18,
            'section'     => 'oria_fonts',
            'label'       => __('H2 font size', 'oria'),
            'input_attrs' => array(
                'min'   => 10,
                'max'   => 60,
                'step'  => 1,
                'style' => 'margin-bottom: 15px; padding: 10px;',
            ),
        ) );
        //H3 size
        $wp_customize->add_setting(
            'h3_size',
            array(
                'sanitize_callback' => 'absint',
                'default'           => '24',
            )
        );
        $wp_customize->add_control( 'h3_size', array(
            'type'        => 'number',
            'priority'    => 19,
            'section'     => 'oria_fonts',
            'label'       => __('H3 font size', 'oria'),
            'input_attrs' => array(
                'min'   => 10,
                'max'   => 60,
                'step'  => 1,
                'style' => 'margin-bottom: 15px; padding: 10px;',
            ),
        ) );
        //H4 size
        $wp_customize->add_setting(
            'h4_size',
            array(
                'sanitize_callback' => 'absint',
                'default'           => '18',
            )
        );
        $wp_customize->add_control( 'h4_size', array(
            'type'        => 'number',
            'priority'    => 20,
            'section'     => 'oria_fonts',
            'label'       => __('H4 font size', 'oria'),
            'input_attrs' => array(
                'min'   => 10,
                'max'   => 60,
                'step'  => 1,
                'style' => 'margin-bottom: 15px; padding: 10px;',
            ),
        ) );
        //H5 size
        $wp_customize->add_setting(
            'h5_size',
            array(
                'sanitize_callback' => 'absint',
                'default'           => '14',
            )
        );
        $wp_customize->add_control( 'h5_size', array(
            'type'        => 'number',
            'priority'    => 21,
            'section'     => 'oria_fonts',
            'label'       => __('H5 font size', 'oria'),
            'input_attrs' => array(
                'min'   => 10,
                'max'   => 60,
                'step'  => 1,
                'style' => 'margin-bottom: 15px; padding: 10px;',
            ),
        ) );
        //H6 size
        $wp_customize->add_setting(
            'h6_size',
            array(
                'sanitize_callback' => 'absint',
                'default'           => '12',
            )
        );
        $wp_customize->add_control( 'h6_size', array(
            'type'        => 'number',
            'priority'    => 22,
            'section'     => 'oria_fonts',
            'label'       => __('H6 font size', 'oria'),
            'input_attrs' => array(
                'min'   => 10,
                'max'   => 60,
                'step'  => 1,
                'style' => 'margin-bottom: 15px; padding: 10px;',
            ),
        ) );
        //Body
        $wp_customize->add_setting(
            'body_size',
            array(
                'sanitize_callback' => 'absint',
                'default'           => '15',
                'transport'         => 'postMessage'
            )
        );
        $wp_customize->add_control( 'body_size', array(
            'type'        => 'number',
            'priority'    => 23,
            'section'     => 'oria_fonts',
            'label'       => __('Body font size', 'oria'),
            'input_attrs' => array(
                'min'   => 10,
                'max'   => 24,
                'step'  => 1,
                'style' => 'margin-bottom: 15px; padding: 10px;',
            ),
        ) );
    
        //___Colors___//
        //Primary color
        $wp_customize->add_setting(
            'primary_color',
            array(
                'default'           => '#EF997F',
                'sanitize_callback' => 'sanitize_hex_color',
            )
        );
        $wp_customize->add_control(
            new WP_Customize_Color_Control(
                $wp_customize,
                'primary_color',
                array(
                    'label'         => 'Primary color',
                    'section'       => 'colors',
                    'settings'      => 'primary_color',
                    'priority'      => 12
                )
            )
        );
        //Site title
        $wp_customize->add_setting(
            'site_title_color',
            array(
                'default'           => '#fff',
                'sanitize_callback' => 'sanitize_hex_color',
                'transport'         => 'postMessage'
            )
        );
        $wp_customize->add_control(
            new WP_Customize_Color_Control(
                $wp_customize,
                'site_title_color',
                array(
                    'label' => 'Site title',
                    'section' => 'colors',
                    'settings' => 'site_title_color',
                    'priority' => 18
                )
            )
        );
        //Site desc
        $wp_customize->add_setting(
            'site_desc_color',
            array(
                'default'           => '#bbb',
                'sanitize_callback' => 'sanitize_hex_color',
                'transport'         => 'postMessage'
            )
        );
        $wp_customize->add_control(
            new WP_Customize_Color_Control(
                $wp_customize,
                'site_desc_color',
                array(
                    'label' => 'Site description',
                    'section' => 'colors',
                    'priority' => 19
                )
            )
        );
        //Body
        $wp_customize->add_setting(
            'body_text_color',
            array(
                'default'           => '#717376',
                'sanitize_callback' => 'sanitize_hex_color',
                'transport'         => 'postMessage'
            )
        );
        $wp_customize->add_control(
            new WP_Customize_Color_Control(
                $wp_customize,
                'body_text_color',
                array(
                    'label' => 'Body text',
                    'section' => 'colors',
                    'settings' => 'body_text_color',
                    'priority' => 22
                )
            )
        );
    
    
        //___Footer___//
        $wp_customize->add_section(
            'oria_footer',
            array(
                'title'         => __('Footer widgets', 'oria'),
                'priority'      => 18,
            )
        );
        $wp_customize->add_setting(
            'footer_widget_areas',
            array(
                'default'           => '3',
                'sanitize_callback' => 'oria_sanitize_fwidgets',
            )
        );
        $wp_customize->add_control(
            'footer_widget_areas',
            array(
                'type'        => 'radio',
                'label'       => __('Footer widget area', 'oria'),
                'section'     => 'oria_footer',
                'description' => __('Choose the number of widget areas in the footer, then go to Appearance > Widgets and add your widgets.', 'oria'),
                'choices' => array(
                    '1'     => __('One', 'oria'),
                    '2'     => __('Two', 'oria'),
                    '3'     => __('Three', 'oria'),
                ),
            )
        );
    
    }
    add_action( 'customize_register', 'oria_customize_register' );
    
    /**
    * Sanitize
    */
    //Text
    function oria_sanitize_text( $input ) {
        return wp_kses_post( force_balance_tags( $input ) );
    }
    //Checkboxes
    function oria_sanitize_checkbox( $input ) {
        if ( $input == 1 ) {
            return 1;
        } else {
            return '';
        }
    }
    // Logo style
    function oria_sanitize_logo_style( $input ) {
        $valid = array(
                    'hide-title'  => __( 'Only logo', 'oria' ),
                    'show-title'  => __( 'Logo plus site title&description', 'oria' ),
                );
        if ( array_key_exists( $input, $valid ) ) {
            return $input;
        } else {
            return '';
        }
    }
    //Footer widget areas
    function oria_sanitize_fwidgets( $input ) {
        $valid = array(
            '1'     => __('One', 'oria'),
            '2'     => __('Two', 'oria'),
            '3'     => __('Three', 'oria'),
        );
        if ( array_key_exists( $input, $valid ) ) {
            return $input;
        } else {
            return '';
        }
    }
    //Integers
    function oria_sanitize_int( $input ) {
        if( is_numeric( $input ) ) {
            return intval( $input );
        }
    }
    /**
     * Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
     */
    function oria_customize_preview_js() {
    	wp_enqueue_script( 'oria_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20130508', true );
    }
    add_action( 'customize_preview_init', 'oria_customize_preview_js' );
    
    function oria_registers() {
    	wp_enqueue_script( 'oria_customizer_script', get_template_directory_uri() . '/js/oria_customizer.js', array("jquery"), '20120206', true  );
    
    	wp_localize_script( 'oria_customizer_script', 'oriaCustomizerObject', array(
    		'github'				=> __('GitHub','oria'),
    		'review'				=> __('Leave a Review', 'oria')
    	) );
    }
    add_action( 'customize_controls_enqueue_scripts', 'oria_registers' );

    #2114193
    PhiLyon
    Modérateur
    Maître WordPress
    19371 contributions

    Bonjour.

    Inutile de nous mettre tout ce code qui concerne le thème et non l’extension ?

    Pour cacher la barre de défilement essaies ce code

    .slimScrollRailX, .slimScrollBarX {
    	display:none !important;
    }

    Pour mettre des flèches, pas évident.

    🙂

    #2115864
    Livie2
    Participant
    Initié WordPress
    31 contributions

    Super merci beaucoup PhilLyon !

     

     

7 sujets de 1 à 7 (sur un total de 7)
  • Vous devez être connecté pour répondre à ce sujet.