我试图在我的类别页面上显示每个帖子的精选图片:https://insider.uprighthealth.com/category/exercise-library/
我在所有帖子上都设置了图片,但我不确定需要修改哪些主题文件才能显示精选图片。 (在Canvas和woocommerce上运行儿童主题)
任何帮助都会非常感激,我相信这对于一个php家伙来说很容易解决!
最佳, -M
我找不到category.php文件,但列出了下面的archive.php
<?php
/**
* Archive Template
*
* The archive template is a placeholder for archives that don't have a template file.
* Ideally, all archives would be handled by a more appropriate template according to the
* current page context (for example, `tag.php` for a `post_tag` archive).
*
* @package WooFramework
* @subpackage Template
*/
global $woo_options;
get_header();
?>
<!-- #content Starts -->
<?php woo_content_before(); ?>
<div id="content" class="col-full">
<div id="main-sidebar-container">
<!-- #main Starts -->
<?php woo_main_before(); ?>
<section id="main" class="col-left">
<?php get_template_part( 'loop', 'archive' ); ?>
</section><!-- /#main -->
<?php woo_main_after(); ?>
<?php get_sidebar(); ?>
</div><!-- /#main-sidebar-container -->
<?php get_sidebar( 'alt' ); ?>
</div><!-- /#content -->
<?php woo_content_after(); ?>
<?php get_footer(); ?>
&#13;
内容存档portfolio.php
<?php
/**
* "Portfolio" Content Archive Template
*
* This template is the used to display "portfolio" posts when in a generic archive.
*
* @package WooFramework
* @subpackage Template
*/
/**
* Settings for this template file.
*
* This is where the specify the HTML tags for the title.
* These options can be filtered via a child theme.
*
* @link http://codex.wordpress.org/Plugin_API#Filters
*/
$title_before = '<h1 class="title entry-title">';
$title_after = '</h1>';
if ( ! is_single() ) {
$title_before = $title_before . '<a href="' . get_permalink( get_the_ID() ) . '" rel="bookmark" title="' . the_title_attribute( array( 'echo' => 0 ) ) . '">';
$title_after = '</a>' . $title_after;
}
$page_link_args = apply_filters( 'woothemes_pagelinks_args', array( 'before' => '<div class="page-link">' . __( 'Pages:', 'woothemes' ), 'after' => '</div>' ) );
woo_post_before();
?>
<article <?php post_class( 'post' ); ?>>
<?php
woo_post_inside_before();
?>
<header>
<?php the_title( $title_before, $title_after ); ?>
</header>
<section class="entry">
<?php
echo '<div class="fl portfolio-img">' . woo_image( 'return=true&key=portfolio-image&width=100&height=100' ) . '</div><!--/.fl-->' . "\n";
the_excerpt();
wp_link_pages( $page_link_args );
?>
</section><!-- /.entry -->
<?php
woo_post_inside_after();
?>
</article><!-- /.post -->
<?php
woo_post_after();
comments_template();
?>
&#13;
环archive.php
<?php
/**
* Loop - Archive
*
* This is the loop logic used on all archive screens.
*
* To override this loop in a particular archive type (in all categories, for example),
* duplicate the `archive.php` file and rename the duplicate to `category.php`.
* In the code of `category.php`, change `get_template_part( 'loop', 'archive' );` to
* `get_template_part( 'loop', 'category' );` and save the file.
*
* Create a duplicate of this file and rename it to `loop-category.php`.
* Make any changes to this new file and they will be reflected on all your category screens.
*
* @package WooFramework
* @subpackage Template
*/
global $more; $more = 0;
woo_loop_before();
if (have_posts()) { $count = 0;
$title_before = '<h1 class="archive_header">';
$title_after = '</h1>';
woo_archive_title( $title_before, $title_after );
// Display the description for this archive, if it's available.
woo_archive_description();
?>
<div class="fix"></div>
<?php
while (have_posts()) { the_post(); $count++;
woo_get_template_part( 'content', get_post_type() );
} // End WHILE Loop
} else {
get_template_part( 'content', 'noposts' );
} // End IF Statement
woo_loop_after();
woo_pagenav();
?>
&#13;
答案 0 :(得分:0)
您可以在 loop-archive.php
中进行编辑