작업 작동하지 the_content : (고급 사용자 정의 필드를 통해) 내가 (플러그인 사용자 정의 포스트 UI를 통해) 사용자 정의 포스트 유형을 추가 한워드 프레스 사용자 정의 워드 프레스 사용자 정의 포스트 유형 테마 만들 사용자 정의 포스트 유형
및 사용자 정의 필드를 . 커스텀 포스트가 생성 된 새로운 템플릿 페이지에 올바르게 표시됩니다 (single-custom.php). 개별 맞춤 게시물은 내가 원하는대로 정확하게 표시됩니다.
그러나 문제는 홈페이지에서만 제목이 표시되고 있다는 것입니다.
내가했던 무엇 :
add_filter('pre_get_posts', 'my_get_posts');
function my_get_posts($query) {
if ((is_home() && $query->is_main_query()) || is_feed())
$query->set('post_type', array('post', 'custom'));
return $query;
: 나는 새 게시물의 유형을 허용하려면 다음 코드를 추가 한
1)
은 functions.php를 통해 홈페이지/블로그 피드에 피드에 들어갔습니다 할 : 나는 정의의 콘텐츠 페이지의 내용 custom.php를 생성하고 인덱스 루프를 수정했습니다2)이 그 템플릿을 호출 할 Justin Tadlock에
감사합니다
내 홈페이지에는 여전히 내 맞춤 게시물의 제목 만 표시되며, 전체 내용은 표시하지 않습니다. 문제는 content-custom.php에있는 the_content의 호출과 관련이 있습니다. 그러나 저는 여전히 WordPress에 익숙해 져 있으므로이 문제를 찾을 수 없습니다.
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
//The title below is displayed correctly
<h1 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
</header><!-- .entry-header -->
// The problem begins below. The entry-content div is created but is empty and is not pulling any content from the custom post through the_content call.
<div class="entry-content">
<?php the_content(); ?>
</div><!-- .entry-content -->