Hi,
What I am actually trying to achieve is to have a separate page where my data could be displayed. At first I wanted the plugin to create a page automatically (by entering page name in options menu) but it seems not possible. So a user will have to create a page himself and add a custom field with function from plugin. Then this function will display content in that page.
I have found working example in another plugin, however I’m struggling to adapt it to my needs.
function load_runninglog($content) {
if (is_page()) {
$cust_values = get_post_custom_values($this->runninglog_show);
if ($cust_values != NULL) {
$log_target = $cust_values[0];
$content = $this->display_runninglog($log_target);
}
}
return $content;
}
function display_runninglog($log_target) {
echo "It's working!"
}
I get the following error. Fatal error: Using $this when not in object context in /var/www/wp-content/plugins/running-log/running-log.php on line 264.
I understand I need to get classes involved here. However I’m trying to avoid them as classes go beyond my meager programming knowledge. Is there a way to pass the post id into the function and test if the custom field exists for that post id without using classes?