wordprssの質問です。カスタム投稿タイプで、これが記事のテンプレートです。
<?php echo '<h3>カテゴリー:'.get_the_term_list($post->ID, 'location_category').'</h3>'; ?><br/> <?php echo '<h3>タイトル:'.get_the_title().'</h3>'; ?><br/> <?php echo '<h3>本文:'.get_the_content().'</h3>'; ?><br/>
上のこの部分を見てほしいのですが、カテゴリ―とタイトルは取得できて、表示できるのに、本文の部分が表示されないです。本文:となってcontentの内容は表示されません。どうすればいいでしょうか。
php
1//single-location.php 2<?php 3/* 4Template Name Posts: location 5*/ 6?> 7 8 9<?php 10/** 11 * The template for displaying all single posts 12 * 13 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post 14 * 15 * @package WordPress 16 * @subpackage Twenty_Seventeen 17 * @since 1.0 18 * @version 1.0 19 */ 20 21get_header(); ?> 22 23<?php echo '<h3>カテゴリー:'.get_the_term_list($post->ID, 'location_category').'</h3>'; ?><br/> 24 25<?php echo '<h3>タイトル:'.get_the_title().'</h3>'; ?><br/> 26 27 28<?php echo '<h3>本文:'.get_the_content().'</h3>'; ?><br/> 29 30 31<!--メタデータ取得 lon --> 32<?php 33 // If we are in a loop we can get the post ID easily 34 $lot = get_post_meta( get_the_ID(), 'lon', true ); 35 echo 'lot:'.$lot; 36?> 37<br/> 38<!--メタデータ取得 lat --> 39<?php 40 // If we are in a loop we can get the post ID easily 41 $lat = get_post_meta( get_the_ID(), 'lat', true ); 42 echo 'lat:'.$lat; 43?> 44<br/> 45<!--メタデータ取得 url --> 46<?php 47 // If we are in a loop we can get the post ID easily 48 $url = get_post_meta( get_the_ID(), 'url', true ); 49 echo 'url:'.'<a href="'.$url.'" >MAP</a>'; 50?> 51<br/> 52 53 54 55 56<?php echo get_the_post_thumbnail(); ?> 57 58 59<?php get_sidebar(); ?>
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/05/01 13:48
2017/05/01 13:51
2017/05/01 14:01 編集