1 回答
TA贡献1744条经验 获得超4个赞
您的代码中有一些错误的语法。<? 当我相信你想要的时候,你有一些<?php
我试着为你清理它,所以试试这个。
<?php
/**
* The template for displaying Archive pages
*
* Used to display archive-type pages if nothing more specific matches a query.
* For example, puts together date-based pages if no date.php file exists.
*
* If you'd like to further customize these archive views, you may create a
* new template file for each specific one. For example, Twenty Fourteen
* already has tag.php for Tag archives, category.php for Category archives,
* and author.php for Author archives.
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package WordPress
* @subpackage Twenty_Fourteen
* @since Twenty Fourteen 1.0
*/
get_header(); ?>
<section id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<?php if ( have_posts() ) : ?>
<header class="page-header"><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<h1 class="page-title">
<?php
if ( is_day() ) {
/* translators: %s: Date. */
printf( __( 'Daily Archives: %s', 'twentyfourteen' ), get_the_date() );
} elseif ( is_month() ) {
/* translators: %s: Date. */
printf( __( 'Monthly Archives: %s', 'twentyfourteen' ), get_the_date( _x( 'F Y', 'monthly archives date format', 'twentyfourteen' ) ) );
} elseif ( is_year() ) {
/* translators: %s: Date. */
printf( __( 'Yearly Archives: %s', 'twentyfourteen' ), get_the_date( _x( 'Y', 'yearly archives date format', 'twentyfourteen' ) ) );
} else {
_e( 'Archives', 'twentyfourteen' );
}
?>
</h1>
</header><!-- .page-header -->
<section id="product-list" class="section">
<div class="bandInner">
<?php
if ( function_exists('yoast_breadcrumb') ) {
yoast_breadcrumb('
<p id="breadcrumbs">','</p>
');
}
?> <h1 class='pageTitle'><?php
printf( __( ' %s', 'twentyten' ), '<span>' . single_cat_title( '', false ) . '</span>' );
?></h1>
<?php
wp_nav_menu( array(
'theme_location' => 'product-category',
'container' => 'ul',
'menu_class' => 'prodCats',
) );
?>
<style>
ul.prodCats li{
display:initial!important;
}
ul.prodCats li.current-menu-item a {
color: #8b2131!important;
}
</style>
<article id="mainContent">
<ul id="prodList">
<?php
// Start the Loop.
while ( have_posts() ) :
the_post();
/*
* Include the post format-specific template for the content. If you want
* to use this in a child theme, then include a file called content-___.php
* (where ___ is the post format) and that will be used instead.
*/
?>
<li>
<div class="prodCtn">
<a class="prodImgCtn prodLink" href="<?php echo get_permalink(); ?>">
<?php
$img = wp_get_attachment_image_src( get_field('product_image'), "thumb_product" );
?>
<img class="prodImg" src="<?php echo $img[0]; ?>"/>
</a>
<div class="prodCont">
<a href="<?php echo get_permalink(); ?>" class="">
<p class="prodHd"><?php the_title(); ?></p>
</a>
<p>
<?php
$givchars = 350;
//$postgiv = the_field('product_description');
$postgiv = get_field('product_description');
$modgiv = substr($postgiv, 0, $givchars);
echo ' ' .$modgiv. '... ';
?>
</p>
<a href="<?php echo get_permalink(); ?>" class="btn">
<span class="btnTxt">View More</span>
</a>
</div>
</div>
</li>
<?php
endwhile;?>
</ul>
<div id="show-hide-content" class="cat-content less-mode"><?php echo category_description(); ?></div>
</article>
<?php
// Previous/next page navigation.
endif;
?></div><!-- #content -->
</section>
</div><!-- #content -->
</section><!-- #primary -->
<?php
get_footer();
?>
- 1 回答
- 0 关注
- 125 浏览
添加回答
举报