2016-10-12 2 views
0

나는 웹 사이트를 codding에 워드 프레스 사용자 정의 필드를 보여주고 난 내가 <을 wroted 경우 원하는은 인덱스 페이지

<?php 
 
$my_query = new WP_Query('showposts=10&cat=2'); 
 
while ($my_query->have_posts()): 
 
$my_query->the_post(); 
 
$do_not_duplicate = $post->ID;?> 
 

 
<div class=image><?php if (has_post_thumbnail()) the_post_thumbnail('post-thumb'); ?></div> 
 
<div class=title><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></div> 
 

 
     <---here---> 
 
     
 
<?php endwhile; ?>

에 특별히 고양이의 마지막으로 최근 게시물을 보여 --- 여기 --- > 내 최근 게시물 보여 사용자 정의 필드

처럼 : 가격

내가 이걸 어떻게 할 수 있습니까?

답변

0

<에이 코드를 시도하십시오 --- 여기 ---> 여기

<?php $price = get_post_meta(get_the_ID(), 'custom_field_name', true); ?> 

, 'custom_field_name'= 가격 // 사용자 정의 필드 이름.

+0

이 코드는 작동하지 않습니다. 감사합니다. –

+0

내 실수는 PHP를 사용하고 있습니다. :) –

+0

이 코드는 작동하지만, –