【问题标题】:PHP hack to use post ID inside a query from previous formPHP hack 在以前表单的查询中使用 post ID
【发布时间】:2011-01-31 16:51:37
【问题描述】:

我正在尝试按当前页面上可用帖子的每个 ID 发布在最后一页提交的表单中的数据。我认为这应该在 wordpress 平台上工作,但它没有任何想法。 the_ID() 是用于获取当前帖子 ID 的 wordpress 短代码。

<?php query_posts('post_type=services'); while (have_posts()) : the_post(); 
        $title = $_POST["product_title_PRI_".the_ID()];
echo $title ;?>

太棒了

回答 get_the_ID()

【问题讨论】:

  • 当您自己找到答案时,请实际回答问题,而不是编辑问题以包含答案。它更符合 SO 的格式,而且无需检查已经回答的问题,从而节省了人们的时间。谢谢!

标签: php wordpress forms


【解决方案1】:
<?php query_posts('post_type=services'); while (have_posts()) : the_post(); 
        $title = $_POST["product_title_PRI_".get_the_ID()];
echo $title ;?>

【讨论】:

    猜你喜欢
    • 2023-03-15
    • 2020-04-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-04
    相关资源
    最近更新 更多