2017-08-16 7 views
0

私はWPの開発に新しいです、これは私のクライアントのサイトです:bit.do/dFQtv私はhr以下の各抜粋の下の行を追加する必要があります。以下の行を挿入し、これはコード化され どのように追加するには<hr> WordPressのブログのビューセクション

また、単一のブログ記事のページに示してより多くのボタンをお読みください(テンプレート部品/ 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

あたりはあなたがtemplate-partsフォルダ内に自分のcontent.phpにあなたの<hr>タグの最後の行を追加するには、テーマを見たように。このような :

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

ダブルあなたは正しいファイルを編集して確認してください...私が試した、それだけで記事のタグを閉じた後に時間のタグを追加して、それが幅を変更するためにも、あなたはCSSを書くことができます

+0

こんにちは@Nawinは動作していますが、シングルポストのコンテンツページにも表示されています。このポストURLを参照してください:bit.ly/2uHVIFN、 私はちょうどブログアーカイブページ:bit.do/dFQtv私はおかげで再び仲間、私が思うに、今そのが正常に動作し、単一のポストのためのcomment.phpから時間を取り出し@Nawin –

+0

感謝 –

0

を働いていますそれの色。

<?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" />

関連する問題