我的wordpress网站上有几个插件依赖于wp_enqueue_script函数.最近我有一个使用Cloudflare的客户想要实现Rocket Loader,这是一个自动的javascript异步加载器.问题是几个脚本不能正常使用它,这就是为什么我必须禁止它们自动异步加载.
根据Rocket Loader维基,我需要将data-cfasync ="false"属性插入到标记中,这对于wp_enqueue_script函数似乎是不可能的.
还有其他方法来定义这些属性吗?如果没有,是否有另一种方法可以防止Rocket Loader异步加载这些特定的脚本?
我正在尝试使用我正在处理的博客上的类别帖子(WP-CPL)插件来按类别过滤"最近的帖子".基本上,当有人点击博客上的类别名称时,我希望它显示该类别的帖子.这将通过Life Is Simple模板的'archives.php'文件.
插件的短代码是:
[wp_cpl_sc cat_id=40 list_num=4 css_theme=2 sticky_post="79"]
Run Code Online (Sandbox Code Playgroud)
这只是"cat_id"表示插件将显示的类别的示例.我不想只显示一个类别,我希望它在有人点击链接时显示相应的类别.如何让插件识别正在请求的类别并显示相应的帖子?
我知道类别标题是:
<?php single_cat_title(); ?>
Run Code Online (Sandbox Code Playgroud)
但是,我如何以这种方式找到类别ID号?如果需要编辑,我已经将PHP包含在下面标题为'wp_cpl_shortcode.php'的插件文件中.为了简单起见,我宁愿在网站的实际编码中使用短代码.
<?php
/**
* shortcode
* The library of shortcode class
* @author Swashata <swashata4u@gmail.com>
* @subpackage WP Category Post List Plugin
* @version 2.0.0
*/
/**
* The WP CPL shorttag support
* @since 1.1.0
* This was started from the version 1.1.0 and was finished by 2.0.0
*/
class itgdb_wp_cpl_shortcode {
/**
* The wp_cpl_shortcode_handler function
* This function is responsible for converting shortcodes …Run Code Online (Sandbox Code Playgroud) 我正在尝试为我的主题添加一个特色图片,但不是为帖子或页面添加 - 我创建了一个名为Properties的自定义类型(它用于房地产经纪人),因此我如何启用特色图片,因为它没有出现在sceen选项?
希望有人能提供帮助,
$property = new Cuztom_Post_Type( 'Property', array(
'supports' => array('title', 'editor')
));
Run Code Online (Sandbox Code Playgroud) 我正在编写一个包含小部件的WordPress插件,该小部件在页面上显示一个链接,例如:
<a href="<?php echo plugins_url('/ext_page.php', __FILE__); ?>">Link</a>
Run Code Online (Sandbox Code Playgroud)
现在在/ext_page.php页面中,我需要从插件本身获取选项,例如:
$options = get_option('my_plugin_options');
Run Code Online (Sandbox Code Playgroud)
但是函数get_option似乎在该页面中不起作用,有没有其他方法可以获得选项?
请指教,谢谢!
我创建我的WordPress主题里的模板,因为我的模板是一个完全不同的布局比我的活动主题,模板都有它自己的页眉和页脚以及两者的内部我已经正确声明wp_head();和wp_footer();分别.
在我的模板代码中,我试图使用do_shortcode显示重力形式,但没有显示任何形式.当我检查该区域时,我可以看到表单代码,但是有一个style="display:none"添加到.gform_wrapperdiv.
再补充一点,重力形式在我的网站的其余部分(使用活动主题的所有页面/帖子)中都能正常工作,我的自定义模板上只有问题.
任何建议都非常感谢.
谢谢
css wordpress wordpress-theming wordpress-plugin gravity-forms-plugin
我正在开发一个WordPress网站并使用yoast seo插件在动态页面上生成一个og图像.但是,我认为这与此无关.og图像链接显示完美,但如果我单击共享按钮,除非我之前已经点击了共享按钮,或者使用facebook开发人员工具首先刮取页面,否则不会包含图像.
这可能是Facebook问题,还是服务器问题?
我有安装了我的插件的用户(我们称之为v6).
我的插件的V6版本没有注册处理程序upgrader_process_complete.
在我的新版本中,我已upgrader_process_complete注册对数据库表进行一些升级.
但是,当用户使用update now链接从插件页面升级时,似乎不会调用我的新版本的处理程序.
有人能解释一下这个问题吗?
嗨,谢谢你的访问.我目前正在为wordpress编写插件.我需要一个特定页面内的按钮,触发电子邮件通知.我认为使用woocommerce电子邮件功能会很好,因为它是一封客户电子邮件,我也想使用woocommerce-email-templates.
在我的插件中,我包括我的课程扩展名
function add_wc_custom_email( $email_classes ) {
require( 'includes/class-wc-custom-email.php' );
$email_classes['WC_Custom_Email'] = new WC_Custom_Email();
return $email_classes;
}
add_filter( 'woocommerce_email_classes', 'add_wc_custom_email' );
//if i write a print_r(something) inside this function, just to alert if this filters hits, i don't see a result, so i think the error is here.. the filter gets hit under woocommerce->settings->emails but not, if you simply load a page in the backend
Run Code Online (Sandbox Code Playgroud)
在文件类-wc-custom-email.php中我有我的类扩展
class WC_Custom_Email extends WC_Email {
public function __construct() {
…
}
public function mail( …Run Code Online (Sandbox Code Playgroud) 我想写一个wordpress插件,需要更改.htaccess文件.我怎么用PHP做到这一点.我之前已经看过其他插件,但我无法弄清楚它是如何完成的.谢谢!
我安装了Polylang插件并对其进行了配置,但是当我用英语模式加载的网站设置波斯语的默认语言时我遇到了问题,如果更改默认语言则不会因为英文版加载的运行网站中的任何方式而无法使用.我安装了3种语言:波斯语,英语,法语Wordpress版本为4.1.1,Polylang插件版本为1.8.5如何在fa-IR中修复默认语言?请帮我
wordpress-plugin ×10
wordpress ×8
php ×4
cloudflare ×1
css ×1
facebook ×1
javascript ×1
multilingual ×1
oop ×1
woocommerce ×1