GetSimple Support Forum

Full Version: pages sidebar disappearing
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying my hands on making a plugin, and I have encountered a problem already...
I added a side menu on the "Pages" tab, but when I click it, all I get is the output of the function but all the side menu's are gone(i.e.: "View all pages","Create new page" and "Activities")
Here's the full code:
Code:
<?php
/*
Plugin Name: Activities
Description: Display activities
Version:
Author: J-Gamer
Author URI:
*/

# get correct id for plugin
$thisfile=basename(__FILE__, ".php");

register_plugin(
    $thisfile,    // ID of plugin, should be filename minus php
    'Activities',    // Title of plugin
    '',    // Version of plugin
    'Jeroen De Busser',    // Author of plugin
    '',    // Author URL
    '',    // Plugin Description
    '',    // Page type of plugin
    'activities_show'    // Function that displays content
);

add_action('pages-sidebar', 'createSideMenu', array($thisfile, 'Activities'));

# functions
function activities_show() {
    echo '<p>Activities will be edited here</p>';
}
?>

GS version: 3.0
J-Gamer Wrote:I'm trying my hands on making a plugin, and I have encountered a problem already...
I added a side menu on the "Pages" tab, but when I click it, all I get is the output of the function but all the side menu's are gone(i.e.: "View all pages","Create new page" and "Activities")

Add 'pages' as 7th parameter of register_plugin:
Code:
register_plugin(
    $thisfile,    // ID of plugin, should be filename minus php
    'Activities',    // Title of plugin
    '',    // Version of plugin
    'Jeroen De Busser',    // Author of plugin
    '',    // Author URL
    '',    // Plugin Description
    'pages',    // Page type of plugin <== which tab to show when plugin is displayed
    'activities_show'    // Function that displays content
);
Thanks! That fixed it. It's a shame that the functions necessary for plugin development aren't fully documented...
J-Gamer Wrote:Thanks! That fixed it. It's a shame that the functions necessary for plugin development aren't fully documented...

Feel free to add more information to the wiki!
Any forum user can also enhance the wiki.
Other question: do you set this option to other things like
Files
Theme
Backups
Plugins

If you want it to work on the other tabs?

EDIT: it does :p(you only need to change the sidebar creation as well)

EDIT2: and what if you want a single plugin to have side menu links on multiple pages? You can only specify one page in register_plugin AFAIK...