2015-03-30 37 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

相關問題