我创建了一个页面公文包并选择了模板Portfolio Template我的公文包页面无法访问template-portfolio.php 文件其中还包括content-portfolio.php 在模板零件文件夹中。它访问存档。php布局如果将col-lg-8更改为col-lg-7,并删除任何代码行,则会影响公文包页面。无法访问/显示template-portfolio.php 布局/视图这是portfolio-post-type.php
<?php
// Register Portfolio Post Type
function portfolio_post_type() {
$labels = array(
\'name\' => _x( \'portfolios\', \'Post Type General Name\', \'portfolio\' ),
\'singular_name\' => _x( \'portfolio\', \'Post Type Singular Name\', \'portfolio\' ),
\'menu_name\' => __( \'Portfolio\', \'portfolio\' ),
\'name_admin_bar\' => __( \'Portfolio\', \'portfolio\' ),
\'archives\' => __( \'Portfolio Archives\', \'portfolio\' ),
\'attributes\' => __( \'Portfolio Attributes\', \'portfolio\' ),
\'parent_item_colon\' => __( \'Parent Item:\', \'portfolio\' ),
\'all_items\' => __( \'All Portfolio\', \'portfolio\' ),
\'add_new_item\' => __( \'Add New Portfolio\', \'portfolio\' ),
\'add_new\' => __( \'Add New portfolio\', \'portfolio\' ),
\'new_item\' => __( \'New portfolio\', \'portfolio\' ),
\'edit_item\' => __( \'Edit portfolio\', \'portfolio\' ),
\'update_item\' => __( \'Update portfolio\', \'portfolio\' ),
\'view_item\' => __( \'View portfolio\', \'portfolio\' ),
\'view_items\' => __( \'View portfolios\', \'portfolio\' ),
\'search_items\' => __( \'Search portfolio\', \'portfolio\' ),
\'not_found\' => __( \'Not found\', \'portfolio\' ),
\'not_found_in_trash\' => __( \'Not found in Trash\', \'portfolio\' ),
\'featured_image\' => __( \'Featured Image\', \'portfolio\' ),
\'set_featured_image\' => __( \'Set featured image\', \'portfolio\' ),
\'remove_featured_image\' => __( \'Remove featured image\', \'portfolio\' ),
\'use_featured_image\' => __( \'Use as featured image\', \'portfolio\' ),
\'insert_into_item\' => __( \'Insert into item\', \'portfolio\' ),
\'uploaded_to_this_item\' => __( \'Uploaded to this portfolio\', \'portfolio\' ),
\'items_list\' => __( \'Portfolios list\', \'portfolio\' ),
\'items_list_navigation\' => __( \'Portfolios list navigation\', \'portfolio\' ),
\'filter_items_list\' => __( \'Filter portfolios list\', \'portfolio\' ),
);
$args = array(
\'label\' => __( \'portfolio\', \'portfolio\' ),
\'description\' => __( \'display company projects\', \'portfolio\' ),
\'labels\' => $labels,
\'supports\' => array( \'title\', \'editor\', \'thumbnail\' ),
\'taxonomies\' => array( \'category\' ),
\'hierarchical\' => false,
\'public\' => true,
\'show_ui\' => true,
\'show_in_menu\' => true,
\'menu_position\' => 5,
\'menu_icon\' => \'dashicons-portfolio\',
\'show_in_admin_bar\' => true,
\'show_in_nav_menus\' => true,
\'can_export\' => true,
\'has_archive\' => true,
\'exclude_from_search\' => false,
\'publicly_queryable\' => true,
\'capability_type\' => \'page\',
);
register_post_type( \'portfolio\', $args );
}
add_action( \'init\', \'portfolio_post_type\', 0 );
这个
template-portfolio.php get_header();
?>
<div id="primary" class="content-area">
<div id="main" class="site-main col-lg-8 col-md-8 col-sm-8 col-xs-12">
<div class="home-page-data">
<?php
$portfolio = new WP_Query(\'post_type\'=> \'portfolio\');
while ($portfolio-> have_posts() ) :
$portfolio->the_post(); ?>
<div class="col-md-4">
<?php the_post_thumbnail(); ?>
</div>
<?php endwhile; // End of the loop.
?>
</div>
</div><!-- #main -->
<div class="main-sidebar col-lg-4 col-md-4 col-sm-2 col-xs-12">
<?php get_sidebar(); ?>
</div>
</div><!-- #primary -->
<?php
get_footer();
这是
content-portfolio.php <?php
/**
* Template part for displaying page content in template-portfolio.php
*
*
* @package E_blog
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php eblog_post_thumbnail(); ?>
<div class="entry-content">
<?php
the_content();
wp_link_pages( array(
\'before\' => \'<div class="page-links">\' . esc_html__( \'Pages:\', \'eblog\' ),
\'after\' => \'</div>\',
) );
?>
</div><!-- .e
ntry-content -->
<?php if ( get_edit_post_link() ) : ?>
<footer class="entry-footer">
<?php
edit_post_link(
sprintf(
wp_kses(
/* translators: %s: Name of current post. Only visible to screen readers */
__( \'Edit <span class="screen-reader-text">%s</span>\', \'eblog\' ),
array(
\'span\' => array(
\'class\' => array(),
),
)
),
get_the_title()
),
\'<span class="edit-link">\',
\'</span>\'
);
?>
</footer><!-- .entry-footer -->
<?php endif; ?>
</article><!-- #post-<?php the`_ID(); ?> -->`