Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pages sidebar disappearing
#1
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
Reply
#2
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
);
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
#3
Thanks! That fixed it. It's a shame that the functions necessary for plugin development aren't fully documented...
Reply
#4
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.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
#5
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...
Reply




Users browsing this thread: 1 Guest(s)