function helium_add_portfolio_metabox() { $metaboxes = array(); /* Portfolio Archive Page Template */ $metaboxes['portfolio_grid_settings'] = array('title' => esc_html__('Page Template: Portfolio', 'helium'), 'page_template' => 'archive-portfolio', 'fields' => array('use_defaults' => array('type' => 'switch', 'label' => esc_html__('Use Default Settings', 'helium'), 'description' => esc_html__('Switch to use the default portfolio grid settings.', 'helium'), 'std' => false), 'show_filter' => array('type' => 'switch', 'label' => esc_html__('Show Filter', 'helium'), 'description' => esc_html__('Switch to display the portfolio filter.', 'helium'), 'criteria' => 'use_defaults:is(0)', 'std' => true), 'pagination' => array('type' => 'select', 'label' => esc_html__('Pagination Type', 'helium'), 'description' => esc_html__('Specify the portfolio pagination type.', 'helium'), 'choices' => array('ajax' => esc_html__('AJAX', 'helium'), 'infinite' => esc_html__('Infinite', 'helium'), 'numbered' => esc_html__('Numbered', 'helium'), 'prev_next' => esc_html__('Prev/Next', 'helium'), 'show_all' => esc_html__('None (Show all)', 'helium')), 'criteria' => 'use_defaults:is(0)', 'std' => 'ajax'), 'ajax_button_text' => array('type' => 'text', 'label' => esc_html__('AJAX Button Text', 'helium'), 'description' => esc_html__('Specify the text to display on the AJAX load more button.', 'helium'), 'std' => 'Load More', 'criteria' => 'pagination:is(ajax),use_defaults:is(0)'), 'ajax_button_complete_text' => array('type' => 'text', 'label' => esc_html__('AJAX Button Complete Text', 'helium'), 'description' => esc_html__('Specify the text to display on the AJAX load more button when there are no more items to load.', 'helium'), 'std' => 'No More Items', 'criteria' => 'pagination:is(ajax),use_defaults:is(0)'), 'posts_per_page' => array('type' => 'uislider', 'label' => esc_html__('Posts Per Page', 'helium'), 'description' => esc_html__('Specify how many portfolio items to show per page.', 'helium'), 'widgetopts' => array('min' => 1, 'max' => 20, 'step' => 1), 'criteria' => 'use_defaults:is(0),pagination:not(show_all)', 'std' => 10), 'include' => array('type' => 'checkboxlist', 'label' => esc_html__('Included Categories', 'helium'), 'description' => esc_html__('Specify the portfolio categories to include (leave unchecked to include all).', 'helium'), 'choices' => get_terms(youxi_portfolio_tax_name(), array('fields' => 'id=>name', 'hide_empty' => false)), 'criteria' => 'use_defaults:is(0)'), 'behavior' => array('type' => 'select', 'label' => esc_html__('Behavior', 'helium'), 'description' => esc_html__('Specify the behavior when clicking the thumbnail image.', 'helium'), 'choices' => array('none' => esc_html__('None', 'helium'), 'lightbox' => esc_html__('Show Image in Lightbox', 'helium'), 'page' => esc_html__('Go to Detail Page', 'helium')), 'criteria' => 'use_defaults:is(0)'), 'orderby' => array('type' => 'select', 'label' => esc_html__('Order By', 'helium'), 'description' => esc_html__('Specify in what order the items should be displayed.', 'helium'), 'choices' => array('date' => esc_html__('Date', 'helium'), 'menu_order' => esc_html__('Menu Order', 'helium'), 'title' => esc_html__('Title', 'helium'), 'ID' => esc_html__('ID', 'helium')), 'criteria' => 'use_defaults:is(0)', 'std' => 'date'), 'order' => array('type' => 'select', 'label' => esc_html__('Order', 'helium'), 'description' => esc_html__('Specify how to order the items.', 'helium'), 'choices' => array('DESC' => esc_html__('Descending', 'helium'), 'ASC' => esc_html__('Ascending', 'helium')), 'criteria' => 'use_defaults:is(0),orderby:not(menu_order)', 'std' => 'DESC'), 'layout' => array('type' => 'select', 'label' => esc_html__('Layout', 'helium'), 'description' => esc_html__('Specify the portfolio layout.', 'helium'), 'choices' => array('classic' => esc_html__('Classic', 'helium'), 'masonry' => esc_html__('Masonry', 'helium'), 'justified' => esc_html__('Justified', 'helium')), 'criteria' => 'use_defaults:is(0)', 'std' => 'justified'), 'columns' => array('type' => 'uislider', 'label' => esc_html__('Columns', 'helium'), 'description' => esc_html__('Specify in how many columns the items should be displayed in the masonry/classic layout.', 'helium'), 'widgetopts' => array('min' => 3, 'max' => 5, 'step' => 1), 'std' => 4, 'criteria' => 'use_defaults:is(0),layout:not(justified)'))); $metaboxes['portfolio_slider_settings'] = array('title' => esc_html__('Page Template: Portfolio Slider', 'helium'), 'page_template' => 'page-templates/portfolio-slider', 'fields' => array('posts_per_page' => array('type' => 'uislider', 'label' => esc_html__('Number of Slides', 'helium'), 'description' => esc_html__('Specify how many portfolio items to show on the slider.', 'helium'), 'widgetopts' => array('min' => 1, 'max' => 10, 'step' => 1), 'std' => 5), 'orderby' => array('type' => 'select', 'label' => esc_html__('Order By', 'helium'), 'description' => esc_html__('Specify in what order the items should be displayed.', 'helium'), 'choices' => array('date' => esc_html__('Date', 'helium'), 'menu_order' => esc_html__('Menu Order', 'helium'), 'title' => esc_html__('Title', 'helium'), 'ID' => esc_html__('ID', 'helium'), 'rand' => esc_html__('Random', 'helium')), 'std' => 'date'), 'order' => array('type' => 'select', 'label' => esc_html__('Order', 'helium'), 'description' => esc_html__('Specify how to order the items.', 'helium'), 'choices' => array('DESC' => esc_html__('Descending', 'helium'), 'ASC' => esc_html__('Ascending', 'helium')), 'std' => 'DESC', 'criteria' => 'orderby:not(menu_order)'))); /* Create the 'page' post type object */ $post_type_object = Youxi_Post_Type::get('page'); /* Add the metaboxes */ foreach ($metaboxes as $metabox_id => $metabox) { $post_type_object->add_meta_box(new Youxi_Metabox($metabox_id, $metabox)); } }
?> " title="<?php the_title_attribute(); ?> "> <?php the_post_thumbnail('helium_16by9'); ?> </a> </figure><?php } } the_title('<h5 class="related-entry-title"><a href="' . esc_url(get_permalink()) . '" rel="bookmark">', '</a></h5>'); ?> <p class="related-entry-meta"><?php echo get_the_term_list(get_the_ID(), youxi_portfolio_tax_name(), '', ', '); ?> </p> <div class="spacer-30 hidden-md hidden-lg"></div> </article> <?php } wp_reset_postdata(); ?> </div> </div> </div>
foreach ($gridlist_attributes as $attr => $value) { $gridlist_attributes[$attr] = $attr . '="' . esc_attr($value) . '"'; } $gridlist_attributes = join(' ', $gridlist_attributes); // Determine thumbnail size $thumbnail_size = 'classic' == $grid_settings['layout'] ? 'helium_portfolio_thumb_4by3' : 'helium_portfolio_thumb'; ?> <div <?php echo $gridlist_attributes; ?> > <?php if ($grid_settings['show_filter']) { /* Get portfolio taxonomy terms */ $terms = get_terms(youxi_portfolio_tax_name(), array('include' => $grid_settings['include'])); /* Output portfolio filters */ if ($terms && count($terms) > 1) { ?> <div class="grid-list-filter"> <span class="filter-label"><?php esc_html_e('Filter', 'helium'); ?> </span><?php ?> <ul class="filter-items plain-list"><?php ?> <li> <a href="<?php echo esc_url(get_post_type_archive_link(youxi_portfolio_cpt_name())); ?>
public function portfolio_customizer($wp_customize) { $prefix = $this->prefix(); if (method_exists($wp_customize, 'add_panel')) { $section_priority = 0; $section_title_prefix = ''; $wp_customize->add_panel($prefix . '_portfolio', array('title' => esc_html__('Portfolio', 'helium'), 'priority' => 46)); } else { $section_priority = 46; $section_title_prefix = esc_html__('Portfolio', 'helium') . ' '; } /* Section: Single */ $wp_customize->add_section($prefix . '_portfolio_single', array('title' => $section_title_prefix . esc_html__('Single Item', 'helium'), 'priority' => ++$section_priority, 'panel' => $prefix . '_portfolio')); /* Single Settings */ $wp_customize->add_setting($prefix . '[portfolio_show_related_items]', array('default' => true, 'sanitize_callback' => array(get_class(), 'sanitize_boolean'))); $wp_customize->add_setting($prefix . '[portfolio_related_items_count]', array('default' => 3, 'sanitize_callback' => 'absint')); $wp_customize->add_setting($prefix . '[portfolio_related_items_behavior]', array('default' => 'lightbox')); /* Single Controls */ $wp_customize->add_control(new Youxi_Customize_Switch_Control($wp_customize, $prefix . '[portfolio_show_related_items]', array('label' => esc_html__('Show Related Items', 'helium'), 'section' => $prefix . '_portfolio_single', 'priority' => 1))); $wp_customize->add_control(new Youxi_Customize_Range_Control($wp_customize, $prefix . '[portfolio_related_items_count]', array('label' => esc_html__('Related Items Count', 'helium'), 'section' => $prefix . '_portfolio_single', 'min' => 3, 'max' => 4, 'step' => 1, 'priority' => 2))); $wp_customize->add_control($prefix . '[portfolio_related_items_behavior]', array('label' => esc_html__('Related Items Behavior', 'helium'), 'section' => $prefix . '_portfolio_single', 'type' => 'select', 'choices' => array('lightbox' => esc_html__('Show Lightbox', 'helium'), 'permalink' => esc_html__('Go to Post', 'helium')), 'priority' => 3)); /* Section: Archive */ $wp_customize->add_section($prefix . '_portfolio_archive', array('title' => $section_title_prefix . esc_html__('Archive', 'helium'), 'priority' => ++$section_priority, 'panel' => $prefix . '_portfolio')); /* Archive Settings */ $wp_customize->add_setting($prefix . '[portfolio_archive_page_title]', array('default' => esc_html__('Portfolio Archive', 'helium'), 'sanitize_callback' => 'sanitize_text_field')); /* Archive Controls */ $wp_customize->add_control($prefix . '[portfolio_archive_page_title]', array('label' => esc_html__('Page Title', 'helium'), 'section' => $prefix . '_portfolio_archive', 'type' => 'text', 'priority' => 1)); /* Section: Grid */ $wp_customize->add_section($prefix . '_portfolio_grid', array('title' => $section_title_prefix . esc_html__('Grid Settings', 'helium'), 'priority' => ++$section_priority, 'panel' => $prefix . '_portfolio')); /* Grid Settings */ $wp_customize->add_setting($prefix . '[portfolio_grid_show_filter]', array('default' => true, 'sanitize_callback' => array(get_class(), 'sanitize_boolean'))); $wp_customize->add_setting($prefix . '[portfolio_grid_pagination]', array('default' => 'ajax')); $wp_customize->add_setting($prefix . '[portfolio_grid_ajax_button_text]', array('default' => esc_html__('Load More', 'helium'), 'sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_setting($prefix . '[portfolio_grid_ajax_button_complete_text]', array('default' => esc_html__('No More Items', 'helium'), 'sanitize_callback' => 'sanitize_text_field')); $wp_customize->add_setting($prefix . '[portfolio_grid_posts_per_page]', array('default' => get_option('posts_per_page'), 'sanitize_callback' => 'absint')); $wp_customize->add_setting($prefix . '[portfolio_grid_include]', array('default' => array())); $wp_customize->add_setting($prefix . '[portfolio_grid_behavior]', array('default' => 'lightbox')); $wp_customize->add_setting($prefix . '[portfolio_grid_orderby]', array('default' => 'date')); $wp_customize->add_setting($prefix . '[portfolio_grid_order]', array('default' => 'DESC')); $wp_customize->add_setting($prefix . '[portfolio_grid_layout]', array('default' => 'masonry')); $wp_customize->add_setting($prefix . '[portfolio_grid_columns]', array('default' => 4, 'sanitize_callback' => 'absint')); // $wp_customize->add_setting( $prefix . '[portfolio_grid_justified_min_height]', array( // 'default' => 240 // )); /* Grid Controls */ $wp_customize->add_control(new Youxi_Customize_Switch_Control($wp_customize, $prefix . '[portfolio_grid_show_filter]', array('label' => esc_html__('Show Filter', 'helium'), 'section' => $prefix . '_portfolio_grid', 'priority' => 2))); $wp_customize->add_control($prefix . '[portfolio_grid_pagination]', array('label' => esc_html__('Pagination', 'helium'), 'section' => $prefix . '_portfolio_grid', 'type' => 'select', 'choices' => array('ajax' => esc_html__('AJAX', 'helium'), 'infinite' => esc_html__('Infinite', 'helium'), 'numbered' => esc_html__('Numbered', 'helium'), 'prev_next' => esc_html__('Prev/Next', 'helium'), 'show_all' => esc_html__('None (Show all)', 'helium')), 'priority' => 3)); $wp_customize->add_control($prefix . '[portfolio_grid_ajax_button_text]', array('label' => esc_html__('AJAX Button Text', 'helium'), 'section' => $prefix . '_portfolio_grid', 'type' => 'text', 'priority' => 4)); $wp_customize->add_control($prefix . '[portfolio_grid_ajax_button_complete_text]', array('label' => esc_html__('AJAX Button Complete Text', 'helium'), 'section' => $prefix . '_portfolio_grid', 'type' => 'text', 'priority' => 5)); $wp_customize->add_control(new Youxi_Customize_Range_Control($wp_customize, $prefix . '[portfolio_grid_posts_per_page]', array('label' => esc_html__('Items per Page', 'helium'), 'section' => $prefix . '_portfolio_grid', 'min' => 1, 'max' => 20, 'step' => 1, 'priority' => 5.5))); $wp_customize->add_control(new Youxi_Customize_Multicheck_Control($wp_customize, $prefix . '[portfolio_grid_include]', array('label' => esc_html__('Included Categories', 'helium'), 'section' => $prefix . '_portfolio_grid', 'choices' => get_terms(youxi_portfolio_tax_name(), array('fields' => 'id=>name')), 'priority' => 5.6, 'description' => esc_html__('Uncheck all to include all categories.', 'helium')))); $wp_customize->add_control($prefix . '[portfolio_grid_behavior]', array('label' => esc_html__('Behavior', 'helium'), 'section' => $prefix . '_portfolio_grid', 'type' => 'select', 'choices' => array('none' => esc_html__('None', 'helium'), 'lightbox' => esc_html__('Show Image in Lightbox', 'helium'), 'page' => esc_html__('Go to Detail Page', 'helium')), 'priority' => 6)); $wp_customize->add_control($prefix . '[portfolio_grid_orderby]', array('label' => esc_html__('Order By', 'helium'), 'section' => $prefix . '_portfolio_grid', 'type' => 'select', 'choices' => array('date' => esc_html__('Date', 'helium'), 'menu_order' => esc_html__('Menu Order', 'helium'), 'title' => esc_html__('Title', 'helium'), 'ID' => esc_html__('ID', 'helium')), 'priority' => 7)); $wp_customize->add_control($prefix . '[portfolio_grid_order]', array('label' => esc_html__('Order', 'helium'), 'section' => $prefix . '_portfolio_grid', 'type' => 'select', 'choices' => array('DESC' => esc_html__('Descending', 'helium'), 'ASC' => esc_html__('Ascending', 'helium')), 'priority' => 8)); $wp_customize->add_control($prefix . '[portfolio_grid_layout]', array('label' => esc_html__('Layout', 'helium'), 'section' => $prefix . '_portfolio_grid', 'type' => 'select', 'choices' => array('masonry' => esc_html__('Masonry', 'helium'), 'classic' => esc_html__('Classic', 'helium'), 'justified' => esc_html__('Justified', 'helium')), 'priority' => 9)); $wp_customize->add_control(new Youxi_Customize_Range_Control($wp_customize, $prefix . '[portfolio_grid_columns]', array('label' => esc_html__('Columns (Masonry/Classic)', 'helium'), 'section' => $prefix . '_portfolio_grid', 'min' => 3, 'max' => 5, 'step' => 1, 'priority' => 10))); }