wordpress插件在不同的页面上有不同的内容
你能帮我做一下吗?我正在建立插件,将根据不同的网页显示不同的内容。 例如,在第1页上会有一个内容,在第2页上会有另一个内容,而在所有其他页面上,内容都会保持原样。 这是我的插件代码,我只为特定页面获取内容并进行更改:wordpress插件在不同的页面上有不同的内容,wordpress,custom-wordpress-pages,Wordpress,Custom Wordpress Pages,你能帮我做一下吗?我正在建立插件,将根据不同的网页显示不同的内容。 例如,在第1页上会有一个内容,在第2页上会有另一个内容,而在所有其他页面上,内容都会保持原样。 这是我的插件代码,我只为特定页面获取内容并进行更改: $content = get_the_content(); $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); w
$content = get_the_content();
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
wp_enqueue_script('ajax_bill', '/wp-content/plugins/ed-merna-mesta/js/ajax_bill.js');
wp_enqueue_style('styles', '/wp-content/plugins/ed-merna-mesta/css/styles.css');
include_once("php/functions.php");
include_once("php/functions_helper.php");
add_filter('the_content','get_plugin_page_content', $content);
function get_plugin_page_content($content) {
if (is_page('page1')) {
get_accounts_list();
}
else if (is_page('page2'))
{
last_account_bill();
}
else
echo $content;
}
问题是主页显示的内容类似于我有一些随机文本:
[三分之一]
包括很多字体
[图标铅笔]Quisque convallis orci ut lauct imperted eget lobortis dolor tellus pharetra。在多洛-哈比塞斯高原,一句名言。整株紫苏。同侧隐窝位于远处的amet platea。这是一个有缺陷的疾病。[按钮url=]阅读更多…[/button][三分之一][三分之一]
显示内容时出现问题!
当我评论行时:
添加过滤器'the_content','get_plugin_page_content',$content;
主页插件上一切正常,当然没有显示任何内容
我用的是清晰的主题。
我哪里做错了
谢谢。如果有人遇到同样的问题,我会想出来: 我需要:
do_shortcode( $content );