View file StuffPost/stuffpost/functions/customizer/panel-home.php

File size: 2.83Kb
<?php
$i=0;

// PANEL & SECTIONS
  $wp_customize->add_panel( 'home_layout', array(
    'priority'    => 10,
    'title'       => esc_attr__( 'Home Layout', 'stuffpost' ),
    'description'       => esc_attr__( 'Select a section and setup what do you want to display on it.', 'stuffpost' ),
  ) );

  for ($i=0; $i <=6; $i++) {
    $wp_customize->add_section( 'section'.$i, array(
      'title'          => esc_attr__( 'Position #', 'stuffpost' ).($i+1),
      'panel'          => 'home_layout',
      'priority'       => 160,
    ) );
  }

// array for layouts settings
  $layout = array(
    'layout_1' => esc_html__( 'Featured 1', 'stuffpost' ),
    'layout_6' => esc_html__( 'Featured 2', 'stuffpost' ),
    'layout_2' => esc_html__( 'Proposer 1', 'stuffpost' ),
    'layout_5' => esc_html__( 'Proposer 2', 'stuffpost' ),
    'layout_3' => esc_html__( 'Video Slider', 'stuffpost' ),
    'layout_4' => esc_html__( 'Line Slider', 'stuffpost' ),
    'layout_7' => esc_html__( 'Latest Posts', 'stuffpost' ),
    'off' => esc_html__( 'Off this section', 'stuffpost' ),
  );

// layout
  for($i=0; $i<=6; $i++){

    $wp_customize->add_setting( 'htitle_'.$i, array('sanitize_callback' => 'weart_sanitize_text'));
    $wp_customize->add_control( 'htitle_'.$i, array(
      'label' => esc_html__('Title','stuffpost'),
      'description' => esc_html__( 'Name of the section. Leave it blank if you do not want to display.', 'stuffpost' ),
      'section' => 'section'.$i,
      'type' => 'text',
    ));

    $wp_customize->add_setting( 'hlayout_'.$i, array( 'capability' => 'edit_theme_options', 'default' => 'off', 'sanitize_callback' => 'weart_sanitize_radio', ) );
    $wp_customize->add_control( 'hlayout_'.$i, array(
      'type' => 'select',
      'section' => 'section'.$i,
      'label'          => esc_html__('Layout','stuffpost'),
      'description' => esc_html__( 'Layout of the section. Switch off if you want to turn off.', 'stuffpost' ),
      'choices' => $layout,
    ) );

    $wp_customize->add_setting( 'hcat_'.$i, array('sanitize_callback' => 'weart_sanitize_text'));
    $wp_customize->add_control( 'hcat_'.$i, array(
      'label' => esc_html__('Category','stuffpost'),
      'description' => esc_html__( 'Section Post display by Category. Type the category name or leave it empty not want to filter by category.', 'stuffpost' ),
      'section' => 'section'.$i,
      'type' => 'text',
    ));

    $wp_customize->add_setting( 'htag_'.$i, array('sanitize_callback' => 'weart_sanitize_text'));
    $wp_customize->add_control( 'htag_'.$i, array(
      'label' => esc_html__('Tag','stuffpost'),
      'description' => esc_html__( 'Section Post display by Tag. Type the tag name or leave it empty not want to filter by tag.', 'stuffpost' ),
      'section' => 'section'.$i,
      'type' => 'text',
    ));

  }//echo for