繁体   English   中英

无法使WordPress特色图片显示在类别页面上

[英]Can't get WordPress featured image to display on category page

我正在尝试为我的类别页面上的每个帖子显示特色图像: 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(); ?> 

content-archive-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(); ?> 

loop-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(); ?> 

您可以在loop-archive.php中进行编辑

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM