2017-08-16 80 views
0

嗨,大家好我是WP開發新手,這是我的客戶站點:bit.do/dFQtv我需要在每個博客摘錄下面添加hr下面閱讀更多部分,如何操作,如果我插入線下閱讀更多按鈕,顯示在單博客文章頁面也如何在wordpress博客上添加<hr>查看區域

這是編碼:(模板零件/ content.php)

<?php 
/** 
* Template part for displaying posts 
* 
* @link https://codex.wordpress.org/Template_Hierarchy 
* 
* 
*/ 

?> 

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> 
    <header class="entry-header"> 
     <?php 
     if (is_single()) : 
      the_title('<h1 class="entry-title">', '</h1>'); 
     else : 
      the_title('<h2 class="entry-title"><a href="' . esc_url(get_permalink()) . '" rel="bookmark" >', '</a></h2>'); 
     endif; 

     if ('post' === get_post_type()) : ?> 
     <h4 class="meta text-muted"> 
      <?php blog_posted_on(); ?> 
     </h4><!-- .entry-meta --> 
     <?php 
     endif; ?> 

     <!-- AddThis Button BEGIN --> 
    <div class="addthis_inline_share_toolbox_mzc3" style="margin-bottom:20px;" data-title="<?php the_title() ?>" data-url="<?php the_permalink(); ?>" </div> 
     <!-- AddThis Button END --> 

    </header><!-- .entry-header --> 

    <div class="entry-content"> 


     <?php 
        the_content(sprintf (
       /* translators: %s: Name of current post. */ 
       wp_kses(__('Read more', 'blog'), array('span' => array('class' => 
array()))), 

       the_title('<span class="screen-reader-text">"', '"</span>', false) 
      )); 


       wp_link_pages(array(
          'before' => '<div class= "page-links">'. esc_html__('Pages:', 'blog' 
), 

          'after' => '</div>', 
      )); 
     ?> 

    </div><!-- .entry-content --> 

    <footer class="entry-footer"> 
     <?php blog_entry_footer(); ?> 
    </footer><!-- .entry-footer --> 
</article><!-- #post-## --> 

(模板零件/內容page.php文件)

<?php 
/** 
* Template part for displaying page content in page.php 
* 
* @link https://codex.wordpress.org/Template_Hierarchy 
* 
* 
*/ 

?> 

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> 
    <header class="entry-header"> 
     <?php the_title('<h1 class="entry-title">', '</h1>'); ?> 
    </header><!-- .entry-header --> 

    <div class="entry-content"><hr> 
     <?php 
      the_content(); 


      wp_link_pages(array(
       'before' => '<div class="page-links">' . esc_html__('Pages:','blog'), 
       'after' => '</div>', 
      )); 
     ?> 
    </div><!-- .entry-content --> 


    <?php if (get_edit_post_link()) : ?> 
     <footer class="entry-footer"> 
      <?php 
       edit_post_link(
        sprintf(
         /* translators: %s: Name of current post */ 
         esc_html__('Edit %s', 'blog'), 
         the_title('<span class="screen-reader-text">"', '"</span>', false) 
        ), 
        '<span class="edit-link">', 
        '</span>' 
       ); 
      ?> 
<hr> 
     </footer><!-- .entry-footer --> 
    <?php endif; ?> 
</article><!-- #post-## --> 
+0

你試過什麼節目代碼 – Nawin

+0

@Nawin array('class'=> array()))),


+0

嘗試編輯您的代碼到您的問題,而不是在評論中... – Nawin

回答

0

根據看到您的主題,您將<hr>標記的最後一行添加到template-parts文件夾內的content.php。 這樣的:

<footer class="entry-footer"> 
     <?php bfablog_entry_footer(); ?> 
    </footer><!-- .entry-footer --> 
</article><!-- #post-<?php the_ID(); ?> --><hr> 

仔細檢查你編輯正確的文件。我試着和它的工作

+0

嗨@Nawin它的工作,但它也顯示在單個帖子內容頁面請參閱此帖子url:bit.ly/2uHVIFN, 我只想顯示在博客存檔頁面:bit.do/dFQtv –

+0

謝謝@Nawin我從單個帖子的comment.php中刪除了hr,現在它工作正常,我想,再次感謝bro –

0

關閉的商品標籤後,只要添加標籤的HR,也可以寫CSS爲它改變寬度和它的顏色。

<?php 
 
/** 
 
* Template part for displaying page content in page.php 
 
* 
 
* @link https://codex.wordpress.org/Template_Hierarchy 
 
* 
 
* 
 
*/ 
 

 
?> 
 

 
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> 
 
    <header class="entry-header"> 
 
     <?php the_title('<h1 class="entry-title">', '</h1>'); ?> 
 
    </header><!-- .entry-header --> 
 

 
    <div class="entry-content"><hr> 
 
     <?php 
 
      the_content(); 
 

 

 
      wp_link_pages(array(
 
       'before' => '<div class="page-links">' . esc_html__('Pages:','bfablog'), 
 
       'after' => '</div>', 
 
      )); 
 
     ?> 
 
    </div><!-- .entry-content --> 
 

 

 
    <?php if (get_edit_post_link()) : ?> 
 
     <footer class="entry-footer"> 
 
      <?php 
 
       edit_post_link(
 
        sprintf(
 
         /* translators: %s: Name of current post */ 
 
         esc_html__('Edit %s', 'bfablog'), 
 
         the_title('<span class="screen-reader-text">"', '"</span>', false) 
 
        ), 
 
        '<span class="edit-link">', 
 
        '</span>' 
 
       ); 
 
      ?> 
 
<hr> 
 
     </footer><!-- .entry-footer --> 
 
    <?php endif; ?> 
 
</article><!-- #post-## --> 
 
<hr class="abc" />

相關問題