doufan8805 2012-06-21 02:42 采纳率: 0%
浏览 64

将php值存储在自定义字段wordpress中

I am using Download monitor plugin for wordpress.

I want to store the number of hits of file in the custom fields.

For example :

I am using this code for getting number of hits of file uploaded using download monitor plugin

<?php echo do_shortcode('[download id='. get_post_meta($post->ID, 'did', $single = true) .' format=5]'); ?>

The above code can used only in template files such as single.php and other files.

And in the above code, i am getting the download file id in variable $did in custom fields.

But Now i want to store the number of downloads in database using custom fields.

I want this to work in two ways :

  1. Relate two custom fields.

Once the user inserts the download id $did in one custom field, the next custom field must store the number of downloads in it for that download id.

  1. Execute the php within custom field.

If the user inserts the php code in the custom field, when i click on publish post that php code must be executed and the value must be stored in the custom field.

please guide me on this.

regards, Rias

  • 写回答

1条回答 默认 最新

  • douyu1656 2013-07-29 18:26
    关注

    You can use post meta values to do this.

    Try to call the update_post_meta() setting a custom value each time an user downloads the file.

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度