0

ページに3つの最新ページを表示するこのコードがあります。

これで、3 つの個別のページのコンテンツを表示するページができました。これらの 3 ページのそれぞれに、すべてのコンテンツを表示するのではなく、一定量の文字を表示したいと考えています。その後、個々のページにつながる「続きを読む」リンクが表示されます。

誰かが正しい方向に私を助けることができますか? ありがとう!

 <?php
 query_posts(array('showposts' => <number_of_pages_to_show>, 'post_parent' => <ID of the       parent page>, 'post_type' => 'page'));

 while (have_posts()) { the_post();
 the_title(); 
 the_content();
 }

 wp_reset_query();  // Restore global post data
 ?> 
4

3 に答える 3

0

以下のコードを試すことができます:

 add_filter("the_content", "ContentFilter");  

 function ContentFilter($content)  
    {  
   // Take the existing content and return a subset of it  
  return substr($content, 0, 300);  
  }  

remove_filter('the_content', 'ContentFilter'  );

それが役に立てば幸い

于 2013-11-13T10:45:44.270 に答える
0
<?php $link = get_permalink($post->ID);?>

<a href="<?php echo $link; ?>">read more</a>
于 2013-11-13T10:40:23.940 に答える
0

フィリップ、あなたが交代したほうがいいと思う

the_content();the_excerpt();

于 2013-11-13T10:41:41.107 に答える