Skip to content

Commit

Permalink
adicionando seção Portfolio usando jetpack custom content type
Browse files Browse the repository at this point in the history
  • Loading branch information
diegorojas committed Jun 22, 2017
1 parent 54c3943 commit 924dc60
Show file tree
Hide file tree
Showing 11 changed files with 767 additions and 264 deletions.
8 changes: 8 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@ function coletivo_content_width() {
}
add_action( 'after_setup_theme', 'coletivo_content_width', 0 );

/**
* Add theme support for Portfolio Custom Post Type.
*/
add_action( 'after_setup_theme', slug_jetpack_portfolio_cpt );
function slug_jetpack_portfolio_cpt() {
add_theme_support( 'jetpack-portfolio' );
}

/**
* Register widget area.
*
Expand Down
12 changes: 12 additions & 0 deletions inc/customizer-selective-refresh.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,18 @@ function coletivo_customizer_partials( $wp_customize ) {
),
),

// section portfolio
array(
'id' => 'portfolio',
'selector' => '.section-portfolio',
'settings' => array(
'coletivo_portfolio_content',
'coletivo_portfolio_title',
'coletivo_portfolio_subtitle',
'coletivo_portfolio_desc',
),
),

// section news
array(
'id' => 'news',
Expand Down
152 changes: 152 additions & 0 deletions inc/customizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -1469,6 +1469,158 @@ function coletivo_customize_register( $wp_customize ) {
)
);

/*------------------------------------------------------------------------*/
/* Section: Portfolio
/*------------------------------------------------------------------------*/
$wp_customize->add_panel( 'coletivo_portfolio' ,
array(
'priority' => 140,
'title' => esc_html__( 'Section: Portfolio', 'coletivo' ),
'description' => '',
'active_callback' => 'coletivo_showon_frontpage'
)
);

$wp_customize->add_section( 'coletivo_portfolio_settings' ,
array(
'priority' => 3,
'title' => esc_html__( 'Section Settings', 'coletivo' ),
'description' => '',
'panel' => 'coletivo_portfolio',
)
);

// Show Content
$wp_customize->add_setting( 'coletivo_portfolio_disable',
array(
'sanitize_callback' => 'coletivo_sanitize_checkbox',
'default' => '',
)
);
$wp_customize->add_control( 'coletivo_portfolio_disable',
array(
'type' => 'checkbox',
'label' => esc_html__('Hide this section?', 'coletivo'),
'section' => 'coletivo_portfolio_settings',
'description' => esc_html__('Check this box to hide this section.', 'coletivo'),
)
);

// Section ID
$wp_customize->add_setting( 'coletivo_portfolio_id',
array(
'sanitize_callback' => 'coletivo_sanitize_text',
'default' => esc_html__('portfolio', 'coletivo'),
)
);
$wp_customize->add_control( 'coletivo_portfolio_id',
array(
'label' => esc_html__('Section ID:', 'coletivo'),
'section' => 'coletivo_portfolio_settings',
'description' => esc_html__( 'The section id, we will use this for link anchor.', 'coletivo' )
)
);

// Number of projects to show.
$wp_customize->add_setting( 'coletivo_portfolio_number',
array(
'sanitize_callback' => 'coletivo_sanitize_number',
'default' => '3',
)
);
$wp_customize->add_control( 'coletivo_portfolio_number',
array(
'label' => esc_html__('Number of projects to show', 'coletivo'),
'section' => 'coletivo_portfolio_settings',
'description' => '',
)
);


$wp_customize->add_section( 'coletivo_portfolio_content' ,
array(
'priority' => 6,
'title' => esc_html__( 'Section Content', 'coletivo' ),
'description' => '',
'panel' => 'coletivo_portfolio',
)
);

// Title
$wp_customize->add_setting( 'coletivo_portfolio_title',
array(
'sanitize_callback' => 'sanitize_text_field',
'default' => esc_html__('Our Work', 'coletivo'),
)
);
$wp_customize->add_control( 'coletivo_portfolio_title',
array(
'label' => esc_html__('Section Title', 'coletivo'),
'section' => 'coletivo_portfolio_content',
'description' => '',
)
);

// Sub Title
$wp_customize->add_setting( 'coletivo_portfolio_subtitle',
array(
'sanitize_callback' => 'sanitize_text_field',
'default' => esc_html__('Section subtitle', 'coletivo'),
)
);
$wp_customize->add_control( 'coletivo_portfolio_subtitle',
array(
'label' => esc_html__('Section Subtitle', 'coletivo'),
'section' => 'coletivo_portfolio_content',
'description' => '',
)
);

// Description
$wp_customize->add_setting( 'coletivo_portfolio_desc',
array(
'sanitize_callback' => 'coletivo_sanitize_text',
'default' => '',
)
);
$wp_customize->add_control( new coletivo_Editor_Custom_Control(
$wp_customize,
'coletivo_portfolio_desc',
array(
'label' => esc_html__('Section Description', 'coletivo'),
'section' => 'coletivo_portfolio_content',
'description' => '',
)
));

// Portfolio Button
$wp_customize->add_setting( 'coletivo_portfolio_more_link',
array(
'sanitize_callback' => 'esc_url',
'default' => '#',
)
);
$wp_customize->add_control( 'coletivo_portfolio_more_link',
array(
'label' => esc_html__('Portfolio Button Link', 'coletivo'),
'section' => 'coletivo_portfolio_content',
'description' => esc_html__('It should be your portfolio page link.', 'coletivo' )
)
);
$wp_customize->add_setting( 'coletivo_portfolio_more_text',
array(
'sanitize_callback' => 'sanitize_text_field',
'default' => esc_html__('See Our Portfolio', 'coletivo'),
)
);
$wp_customize->add_control( 'coletivo_portfolio_more_text',
array(
'label' => esc_html__('Portfolio Button Text', 'coletivo'),
'section' => 'coletivo_portfolio_content',
'description' => '',
)
);


/*------------------------------------------------------------------------*/
/* Section: Video Lightbox
Expand Down
Loading

0 comments on commit 924dc60

Please sign in to comment.