【问题标题】:Wordpress shortcode not working in Retro themeWordpress 短代码在复古主题中不起作用
【发布时间】:2013-04-19 02:21:47
【问题描述】:

我正在使用 wordpress 复古主题,并使用插件显示隐藏文本 "[wpex Read more]hidden text[/wpex]" 但它不起作用,数据由自定义函数显示我去那里并将代码更改为 "retun do_shortcode( $result );" 但适用于简单的短代码没有参数,不使用短代码有我之前提到的partmeters。 谁能指导我该怎么做?

非常感谢

【问题讨论】:

  • 显示你的短代码功能

标签: wordpress shortcode


【解决方案1】:

您错过了短代码中的参数,请将 Read More 文本分配给这样的参数

[wpex parameter="Read more"]hidden text[/wpex]

【讨论】:

  • function wpex_process($content) { $offset = 0; $stag = '[wpex'; $etag = '[/wpex]'; while(stripos($content, $stag, $offset)) { // 要替换的字符串 $s = stripos($content, $stag, $offset); $e = stripos($content, $etag, $s) + strlen($etag); // 内部数据 $ds = stripos($content, ']', $s) + 1; $de = $e - strlen($etag); // 样式标签 $ss = $s + strlen($stag); $se = $ds - 1; $sstring = substr($content, $s, $e - $s); $sdesc = substr($content, $ss, $se - $ss); $sdata = substr($content, $ds, $de - $ds);
猜你喜欢
  • 2014-06-04
  • 1970-01-01
  • 1970-01-01
  • 2015-05-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-03-19
相关资源
最近更新 更多