【发布时间】:2016-02-03 23:34:48
【问题描述】:
我正在使用 wordpress 的 metabox 插件 我想从我的一页 wordpress 主题中的一个或几个元框中获得价值。 这是我获取所有页面的方法
/set some variables
//get all the pages on your site
$contact = get_page_by_title( 'Contact' );
$pages = get_pages(array(
'sort_order' => 'ASC',
'sort_column' => 'menu_order',
'exclude' => $contact->ID,
) );
foreach ($pages as $page_data) {
$content = apply_filters('the_content', $page_data->post_content);
$title = $page_data->post_title;
$slug = $page_data->post_name;
$pageid=$page_data->ID;
$couleur=rwmb_meta('twg_couleur');
//Put a container around every page's content
echo "<div class='container-fluid content $pageid' id='$slug'>";
echo "<div class='container'>";
//Heading and Content
echo "<h1>$title</h1>";
echo $content;
echo $couleur;
echo "</div>";
echo "</div>";
}
;
但我的 var 没有出现。 如果我打电话给她,她就在单页上,但单页模板上似乎是空的或不存在。
我该怎么做?
非常感谢您的帮助
【问题讨论】:
标签: php wordpress meta-boxes