2014-09-29 3 views
0

여러 개의 퀴즈에 사용되는 js 퀴즈 템플릿이 있습니다. 각 템플릿의 짤막한 부분을 보여 드리고 싶습니다. 나는 템플릿의 상단에 <?php the_excerpt(); ?>을 추가하려고 시도했으나 "click to read more"버튼을 사용한 발췌 부분 만 보여줍니다. "더 많은 것을"읽지 않고 게시물 내용을 발췌하여 부를 수있는 방법이 있습니까?게시물의 맨 위에 발췌문을 표시하십시오.

http://www.lawlessfrench.com/expressions/quiz/

<?php 
/* 
Single Post Template: Quiz 
*/ 

get_header(); 

?> 

<div class="row"> 
<div class="col-md-8 content-area" role="main"> 
<h1><?php the_title();?></h1> 
<h2>French Quiz</h2> 

<?php the_excerpt(); ?> 

<?php if (have_posts()) while (have_posts()) : the_post(); ?> 

<?php endwhile; ?> 
<script type = "text/javascript" src = "<?php echo get_template_directory_uri(); ?>/js/<?php echo get_the_content(); ?>"></script> 
<div id="quiz"> 

<form id="quiz-form"> 

</form> 

</div> 
</div> 
<?php get_sidebar(); ?> 
</div> 
<?php get_footer(); ?> 

답변

0

대신 get_the_excerpt()를 사용해보십시오 :

$my_excerpt = get_the_excerpt(); 
echo $my_excerpt; 

http://codex.wordpress.org/Function_Reference/get_the_excerpt

편집에서 이에 대한 자세한있다 :

이하는 것처럼 루프에서 호출해야 할 것입니다 :

<?php 
global $more; $more = -1; // suppress the more tag 
if (have_posts()) { 
    while (have_posts()) { 
     $my_excerpt = get_the_excerpt(); 
     echo $my_excerpt; 
    } // end while 
} // end if 
?> 
+0

'get_the_excerpt()'가 루프 내에서 사용되어야합니다. 그는 그것을 루프 외부에서 호출하고 있습니다. – rnevius

+0

그게 훨씬 나아 졌어, 고마워,하지만 여전히 "클릭하여 읽기"버튼이있다. – lkl

+0

해당 텍스트를 사용자 정의 할 수 있습니다. http://codex.wordpress.org/Customizing_the_Read_More#Modify_The_Read_More_Link_Text – rnevius

관련 문제