ds15812330851 2015-05-19 15:19
浏览 50
已采纳

在调用短代码时搜索通配符值?

I'm using a Wordpress plugin to generate a form and rather than inserting the form on to the page using the content editor I'm adding it directly to my template.

The problem is that on my local version the id for my form is different to the id of the form on my staging site.

Locally I'm including this in my template to show the form:

<?php echo do_shortcode('[ccf_form id="122"]');?>

But on staging my form has an id of 259 instead, so what I was wondering was, is there a way of searching for a wildcard id? something like:

<?php echo do_shortcode('[ccf_form id="fnmatch(*)"]');?>

or alternately should I find the forms id in phpmyadmin and change it to 122?

I'm using the Custom Contact Forms plugin btw

Please Note

I realise that this question is probably best suited to being on the WP channel but since it's more of a pure PHP question I felt it was worth putting it on here too

  • 写回答

1条回答 默认 最新

  • dongshanya2008 2015-05-19 15:52
    关注

    I worked out the issue was that I'd previously built another form on my staging site using CCF, I went through phpmyadmin posts and deleted everything ccf-based then rebuilt my form and since there were no previous forms this form was assigned the id 122 and my template now works :)

    It would still be good to know if there's a way to search for wildcards using php as that would be a more scaleable and future proof solution

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题