Show links to custom post types in Easy Blogging

Is it possible to add my own links in the Easy Blogging admin?

I'd like to add in some custom post types.

  • Vladislav

    Hi,

    Actually, the plugin already supports this, in a way - although, you will need to add in some code to make it happen. You can manipulate the items in the default Easy Blogging menu by hooking up to wdeb_menu_items filter. This filter accepts one argument (array), which is a list of all menu items. An array of menu items is also expected to be returned from functions processing this filter.

    Each menu item is represented as an associative array, with these keys/values:

    check_callback: Custom PHP callback that will be called prior to rendering the item, in order to determine if the item should be displayed at all.

    capability: Minimum required user capability to display the menu item. This will be checked prior to "check_callback".

    url: Administrative page url (e.g. edit.php).

    icon: Full menu icon URL.

    title: Main text for the menu item.

    help: Will be shown as tooltip and (optionally) transient help text screen for the menu item.

    You can add a page to the default Easy Blogging menu by hooking up to wdeb_menu_items filter, and just adding an entry to the menu list:

    function my_function_add_my_custom_page ($items) {
        $items[] = array (
            'check_callback' => false, // Custom callback function for access checking.
            'capability' => 'edit_posts', // User capability needed to access this page. Can be set to "false".
            'url' => 'post-new.php', // The path to your page
            'icon' => 'http://myhost.com/path-to-my/icon.png', // Full URL to your icon
            'title' => __('New Post', 'wdeb'), // Your link text
            'help' => __('Create a new post', 'wdeb'), // A short help string for your link
        );
        return $items;
    }
    add_filter('wdeb_menu_items', 'my_function_add_my_custom_page');

    Please note the return $items; statement at the end of the function - all processing functions have to return an array of menu items. By hooking into this filter you have pretty much full control over what gets in the menu and what doesn't. Hopefully this is something you can use.

  • Vladislav

    If you're not easily intimidated by the code, you may want to have a look at how the plugin adds its default menu items, in easyblogging/lib/class_wdeb_admin_pages.php, lines 315 through 444. You can also take a look at easyblogging/lib/wdeb_callbacks.php to see some example callbacks used for default menu items.

    If you have any problems with following the code or need more info, please feel free to say so, I'll be happy to help.

  • Moonworks

    Thanks for the help. Giving me those line numbers helped, as I went in and hard-coded a test, just copying/editing the following to what I needed:

    array (
    				'check_callback' => false,
    				'capability' => false,
    				'url' => 'profile.php',
    				'icon' => WDEB_PLUGIN_THEME_URL . '/assets/icons/theme_icons/profiles.png',
    				'title' => __('Profile', 'wdeb'),
    				'help' => __('Edit your profile information', 'wdeb'),
    			),

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.