【问题标题】:wordpress metabox (plugin) display one page themewordpress metabox(插件)显示一页主题
【发布时间】: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


    【解决方案1】:

    好的!

    我只是用

    $couleurs=rwmb_meta('twg_couleur','type=color' , $pageid);
    

    $pageid=$page_data->ID;
    

    它正在工作 谢谢我:-)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-09-09
      • 2014-12-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-13
      相关资源
      最近更新 更多