获取循环数组外的自定义字段 [英] Get custom field outside the loop array

查看:29
本文介绍了获取循环数组外的自定义字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm trying to the $appLink variable with a custom field value outside of the loop. I'm using Wurfl to detect the users device, I'd like to echo the custom field value for the URL. This is what I have but I can't get it to work. Can anyone help please?

 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();
  } 

推荐答案

应该是其中之一

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

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

这篇关于获取循环数组外的自定义字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆