Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/261.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在wordpress中调用元数据_Php_Wordpress_Metadata - Fatal编程技术网

Php 在wordpress中调用元数据

Php 在wordpress中调用元数据,php,wordpress,metadata,Php,Wordpress,Metadata,所以基本上我正在尝试编辑一个名为Showbiz的插件。他们称来自帖子的标准元数据如标题、作者、日期如下: $title = $this->getValue("title"); $alias = $this->getValue("alias"); $urlImage = $this->imageUrl; $text = $this->getValue("slide_text"); $link = $this->getValue("link"); if(empty($

所以基本上我正在尝试编辑一个名为Showbiz的插件。他们称来自帖子的标准元数据如标题、作者、日期如下:

$title = $this->getValue("title");
$alias = $this->getValue("alias");
$urlImage = $this->imageUrl;
$text = $this->getValue("slide_text");

$link = $this->getValue("link");
if(empty($link))
    $link = "#";

$date = $this->getValue("date");

$dateModified = $this->getValue("date_modified");
$excerpt = $this->getValue("excerpt");

$youtubeID = $this->getValue("youtube_id");
$vimeoID = $this->getValue("vimeo_id");
$authorName = $this->getValue("author_name");
$numComments = $this->getValue("num_comments");
$catList = $this->getValue("catlist");
$tagList = $this->getValue("taglist");
$postID = $this->id;

//replace the items in the html
$html = $this->replacePlaceholder("title", $title, $html);
$html = $this->replacePlaceholder("id", $postID, $html);
$html = $this->replacePlaceholder("alias", $alias, $html);
$html = $this->replacePlaceholder("name", $alias, $html);
$html = $this->replacePlaceholder("image", $urlImage, $html);
$html = $this->replacePlaceholder("content", $text, $html);
$html = $this->replacePlaceholder("link", $link, $html);
$html = $this->replacePlaceholder("date", $date, $html);
$html = $this->replacePlaceholder("modified_date", $dateModified, $html);
$html = $this->replacePlaceholder("excerpt", $excerpt, $html);
$html = $this->replacePlaceholder("youtube_id", $youtubeID, $html);
$html = $this->replacePlaceholder("vimeo_id", $vimeoID, $html);
$html = $this->replacePlaceholder("author", $authorName, $html);
$html = $this->replacePlaceholder("numcomments", $numComments, $html);
$html = $this->replacePlaceholder("catlist", $catList, $html);
$html = $this->replacePlaceholder("taglist", $tagList, $html);
我要做的是调用我的自定义post类型数据。要在普通模板文件中执行此操作,我可以添加:

get_post_meta( get_the_ID(), 'META_DATA_NAME', true );
我不知道如何将其添加到模板中。我尝试添加下面的代码,但没有任何价值。有人有什么想法吗?谢谢

$charity = $this->get_post_meta( get_the_ID(), 'META_DATA_NAME', true );

//replace the items in the html
$html = $this->replacePlaceholder("charity", $charity, $html);

getValue函数是否适用于任何post meta或仅适用于娱乐圈已知的那些?你试过

$charity = $this->getValue('META_DATA_NAME');
$html = $this->replacePlaceholder("charity", $charity, $html);

title
alias
中输入外来名称,如
StrackOverfrow
。搜索数据库。现在您有了
元数据\u名称