2014-01-12 3 views
-1

을 텍스트 : 내가 발췌의 끝에서 [...]을 변경하는 방법을변화 [...] I는 외부 웹 사이트 워드 프레스 블로그 게시물 표시하려면이 PHP를 사용하고 워드 프레스 게시물

<?php 
$posts = get_posts('numberposts=10&order=DESC&orderby=post_date'); 
    foreach ($posts as $post) { 
     setup_postdata($post); 
     ?><h2><a href="/blog/<?php echo $post->post_name; ?>"><?php the_title(); ?></a></h2><br> 
     Posted on <?php the_date(); ?><br><br> 
     <?php the_excerpt(); ?> 
     <br><hr /><br> 
     <?php 
    } 
?> 

가되게합니다 [Read More] ?

+0

"발췌 워드 프레스 생략"에 대한 구글에서 검색, 첫 번째 결과 ! – elclanrs

답변

1

복사 테마의 functions.php 파일에이 코드 :

function new_excerpt_more($more) { 
    return '[Read more]'; 
} 
add_filter('excerpt_more', 'new_excerpt_more'); 

아니면 텍스트를 포스트의 링크를 넣어하려는 경우 :

function new_excerpt_more($more) { 
    return ' <a class="read-more" href="'. get_permalink(get_the_ID()) . '">Read More</a>'; 
} 
add_filter('excerpt_more', 'new_excerpt_more'); 
+0

이 코드는 어디에 두어야합니까? – user2710234

+0

답변을 업데이트했습니다. – andreivictor

관련 문제