Can you please help me with following? I am building plugin that will based on different pages show different content.
For example, on page1 there will be one content, on page2 other, and on all other the content will stay as it was.
Here is my plugin code (I take content and change it for specific pages only):
$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;
}
Problem is that home page show something like (I have some random text):
[one_third]
A lot of fonts included
[icon_pencil]Quisque convallis orci ut lacus sed imperdiet eget lobortis dolor tellus pharetra. In hac dolor habitasse platea dictumst. Integer sedelor risus sit mi ligula. Lorem ipsum dolor sit amet platea in distumst. Quisque convallis orci ut lacus sed imperdiet eget lobortis dolor tellus pharetra. [button url=”#”]Read more…[/button] [/one_third] [one_third]
There is some problem with showing the content!
When I comment line:
add_filter(‘the_content’,’get_plugin_page_content’, $content);
everything is OK on home page (plugin not showing anything of course).
I am using clear-theme.
Where am I going wrong???
Thank you.
if anyone stumbles to same problem, I figured it out:
I needed: