【问题标题】:Get custom field outside the loop array获取循环数组外的自定义字段
【发布时间】:2014-09-25 21:39:56
【问题描述】:

我正在尝试在循环外使用自定义字段值的 $appLink 变量。我正在使用 Wurfl 来检测用户设备,我想回显 URL 的自定义字段值。这就是我所拥有的,但我无法让它工作。有人可以帮忙吗?

 else if ($os == 'iOS') 
  {  
  global $wp_query;
  $postid = $wp_query->post->ID;
  $appLink = echo get_post_meta($postid, 'ios_app_link_sb', true);
  wp_reset_query();
  } 

【问题讨论】:

  • $appLink = echo get_post_meta($postid, 'ios_app_link_sb', true); 你确定那条线????
  • 你运气好吗?

标签: php wordpress


【解决方案1】:

应该是

 echo get_post_meta($postid, 'ios_app_link_sb', true);

 $appLink = get_post_meta($postid, 'ios_app_link_sb', true);
 echo $appLink;

【讨论】:

    【解决方案2】:

    试试这个调试 $postid。

    Print_r($id)
    

    如果 $postid 为真,您检查名称键元 'ios_app_link_sb' 是否存在值?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-02-06
      • 1970-01-01
      • 1970-01-01
      • 2019-07-11
      • 2015-05-12
      • 1970-01-01
      • 1970-01-01
      • 2022-07-17
      相关资源
      最近更新 更多