質問は、Wordpress のカスタム メタ フィールドについてです。メタ フィールドに何かが含まれている場合は、メタ値をsingle.phpの必要な場所に表示したいと考えています。ショートコードなら可能だと思います。
function themedemocode($atts,$content = null ) {
return 'What should i do for displaying my meta values ?';
}
add_shortcode('demo', 'themedemocode');
私のメタ フィールド ID は ; ThemeDemoUrlとThemeDownloadUrl ?
-- 解決済み --
function examplewpkeep($atts, $content = null ) {
global $post;
$custom_content = get_post_custom($post->ID);
if (isset($custom_content["UygulamaDemo"])) {
$meta_content = $custom_content["UygulamaDemo"][0];
}
if (isset($custom_content["UygulamaKaynak"])) {
$meta_content = $custom_content["UygulamaKaynak"][0];
}
$meta_content = '<p style="text-align:center;width:600px;"><a class="informational-link" style="color:#fff;text-decoration:none;margin-right:20px;" href="http://www.fatihtoprak.com/git/'.$custom_content["UygulamaDemo"][0].'" target="_blank" />Önizleme.</a><a class="website-link" style="color:#fff;text-decoration:none;" href="http://www.fatihtoprak.com/git/'.$custom_content["UygulamaKaynak"][0].'" target="_blank" />Dosyaları indir.</a></p>';
return $meta_content;
}
add_shortcode('kaynak', 'examplewpkeep');