我正在使用ThemeChills我正在使用的wordpress主题的插件和作者 - Leo,允许我在这里发布他的代码以便找到解决方案,因为他不在城里目前无法帮助我。
问题是,我在页面主要内容上生成的照片库缩略图被限制为10个可见的缩略图(link)。根据作者的说法,我已经使用正确的方法上传了100多张照片。
我很擅长编辑PHP,但不够熟练,无法找到解决方法 - 任何人都有任何想法?
<?php
/**
* Foundation Clearing Shortcode
*
* Enables Foundation Clearing Gallery custom post type for
* use in the Eternity WordPress Theme by ThemeChills.
*
* @package Chills Plugins
* @author ThemeChills
*/
?>
<?php
/*-----------------------------------------------------------------------------------*/
/* REGISTER POST TYPE
/*-----------------------------------------------------------------------------------*/
add_action('init', 'chills_photo_gallery_init');
function chills_photo_gallery_init() {
// Photos custom post type
$labels = array(
'name' => _x( 'Photos', 'chills' ),
'singular_name' => _x( 'Photo', 'chills' ),
'add_new_item' => __( 'Add New Photo', 'chills' ),
'edit_item' => __( 'Edit Photo', 'chills' ),
'new_item' => __( 'New Photo', 'chills' ),
'all_items' => __( 'All Photos', 'chills' ),
'view_item' => __( 'View Photo', 'chills' ),
'search_items' => __( 'Search Photos', 'chills' ),
'not_found' => __( 'No slides found', 'chills' ),
'not_found_in_trash' => __( 'No slides found in the Trash', 'chills' ),
'parent_item_colon' => '',
'menu_name' => 'Photos'
);
$args = array(
'labels' => $labels,
'public' => false,
'show_ui' => true,
'capability_type' => 'post',
'rewrite' => array("slug" => "photo"),
'hierarchical' => false,
'rewrite' => true,
'supports' => array('title', 'editor', 'thumbnail')
);
register_post_type('photo', $args );
}
/*----------------------------------------------------------------------------------- */
/* FOUNDATION CLEARING SHORTCODE
/*-----------------------------------------------------------------------------------*/
/**
* This implements the functionality of the Foundation Clearing Shortcode
* for displaying photos on custom post type.
*
* @since 1.0.0
*
* @param array $attr Attributes of the shortcode.
* @return string HTML content to display photos.
*/
add_shortcode('chills_photo_gallery', 'chills_photo_gallery_shortcode');
function chills_photo_gallery_shortcode( $atts, $content = null ) {
extract(shortcode_atts(array(
'exclude' => '',
'include' => '',
), $atts));
//comma separated user input IDs to array
$post_include = isset($include) && $include != '' ? explode( ',', $include) : '' ;
$post_exclude = isset($exclude) && $exclude != '' ? explode( ',', $exclude) : '' ;
$the_query = new WP_Query(array(
'post_type' => 'photo',
'post_status' => 'publish',
'post__in' => $post_include, //array
'post__not_in' => $post_exclude, //array
'ignore_sticky_posts' => 1,
));
$html = '';
if( $the_query->have_posts() ) :
$html .= '<ul class="clearing-thumbs" data-clearing>';
while ( $the_query->have_posts() ) : $the_query->the_post();
// define the variables
$featured_img = get_the_post_thumbnail( get_the_ID(), 'full' );
$featured_img_title = get_the_title();
$thumbnail_id = get_post_thumbnail_id(get_the_ID());
$thumbnail_object = get_post($thumbnail_id);
$thumbnail_src = $thumbnail_object->guid;
$html.='<li><a href="'.$thumbnail_src.'">'.$featured_img.'<span class="overlay-label">'.$featured_img_title.'</span></a></li>';
endwhile; //END loop
$html .= '</ul>';
endif;
return $html;
}
?>