2015-03-30 42 views
0

我已经加入到我的单post.php中显示日志分类标题上面的代码,它看起来在这里很好: http://thenoirportrait.com/2014/08/23/review-chanel-perfection-lumiere-velvet/添加类别单后页面

但不是在这里: http://thenoirportrait.com/2015/03/04/interior-design-black-home/

我有不同的发布模板。我能做些什么来使这个类别在每一篇文章中都有所改变?

我想我应该把我的类别代码放入Archives.php,但我不确定在哪里。我不想搞乱我的代码,欢迎任何帮助。

这是我的时刻:

<div class="row<?php echo (($behind_title_fw) ? ' full-width' : ''); ?>"> 

     <div class="inner_content"> 

      <div class="row<?php echo (($has_sidebar) ? ' has-sidebar' : ''); ?>"> 

       <div itemscope="" itemtype="http://schema.org/BlogPosting"> 

       <?php if($sidebar_below_title && !$is_endless_template) : ?> 
       <div class="medium-12"> 

        <?php foreach((get_the_category()) as $category) { 
        echo $category->cat_name . ' '; 
        } 
        ?> 
        <br> 
        <br> 

        <article id="post-header-<?php the_ID(); ?>" class="article-header-above" data-postid="<?php echo esc_attr($post->ID); ?>" data-guid="<?php echo esc_attr(get_the_guid($post->ID)); ?>" data-permalink="<?php echo esc_url(get_permalink($post->ID)); ?>"> 

谢谢

回答

0

的第一篇文章的类有宽度:

<div class="row"> 
    <div class="inner_content"> 
     <div class="row"> 
      <div itemscope="" itemtype="http://schema.org/BlogPosting"> 
       REVIEWS <br><br> 
       <div class="medium-12 column"> 
... 

但是第二个,宽度为:

<div class="row"> 
    <div class="inner_content"> 
     <div class="row"> 
      <div itemscope="" itemtype="http://schema.org/BlogPosting"> 
       INTERIOR DESIGN<br><br> 
      <div class="medium-8 column"> 
... 

对齐第二个类别(或其他)的关键是将其放入定义列大小的div中。因此,类别将始终与帖子中心对齐:

<div class="row"> 
    <div class="inner_content"> 
     <div class="row"> 
      <div itemscope="" itemtype="http://schema.org/BlogPosting"> 
       <div class="medium-8 column"> 
        INTERIOR DESIGN<br><br> 
... 
+0

感谢您的回复。我试图做到这一点,但没有出现类别。 我将我的帖子更新为我的代码现在的样子 – 2015-03-30 23:52:58

+0

@TatianaH尝试之前的代码如何? – emibloque 2015-03-31 19:57:42

+0

这是相同的,但没有分类代码: <?php foreach((get_the_category())作为$ category){ echo $ category-> cat_name。 ''; } ?>

2015-04-01 13:50:33

相关问题