• Resolved Diraen

    (@diraen)


    Hi !

    I’ve several authors on my blog and want to allow them to find all the writting instructions they need in the same private page.

    I don’t want to use a plugin.
    I’ve all my private pages.
    I’ve added a custom menu, but it leads to a page where are the links to the private pages.

    First, I’ve created a menu that work but the html code is in the function.php file which is not clean enought for me.

    add_action('admin_menu', 'my_menu_pages');
    function my_menu_pages(){
    						// Add to admin_menu function
    add_menu_page(
    __('How to'), //The title used on the settings page.
    __('How to'), //The title used on the menu.
    'manage_options',  //Only displays the menu if the user matches this capability.
    'custom_admin_how_to',  // The unique name of the menu slug.
    themes.php?goto=build-styleguide-page
    'pg_building_function', //This is the callback function to run to display the page.
    '', //Display a icon just for the menu
    3); //This allows you to choose when the menu item appears in the list
    
    function pg_building_function(){
    if(!current_user_can('manage_options')){
    //wp_die( __( 'Vous n'avez pas les droits pour accèder à cette plop page.' ) );
    }//end if user is allowed.
    //add any form processing code here in PHP:
    ?>
    <div style="width:750px;">
    <h1><span style="position:relative;top:-7px">How to integrate images</span></h1>

    Second , I don’t want to open the “How To” summary in the same page : Authors are supposed to click on this menu while they are writting their post. If the page open directly, they will lost they work. I need it to open to a new window or at least in a new tab.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    To have specific menu items open in a new window/tab would require some sort of javascript or jQuery script to either add a target attribute or open a popup window onclick. Since some menu items have no ID attribute, it would take drilling into the DOM tree to access the correct HTML element.

    Another possibility is to hook one of the several actions on the edit form and simply output the link to the How-To page with the target attribute already built in to the link. Which action would depend on where you want your link to show up. You could use ‘edit_form_after_editor’ to appear after the edit form. Look for do_action() calls on wp-admin/edit-form-advanced.php for other possibilities.

    The link can also appear in a metabox if you like that possibility.

    I believe its possible to add a button to the tinyMCE editor that would open a new page or popup, but I don’t know much about hacking the editor. I’ve no idea how to actually do this particular approach.

    Thread Starter Diraen

    (@diraen)

    Thanks for your answer. I like the idea to work on a “help button” in the tinyMCE interface.
    I’ll digg in.

    Thread Starter Diraen

    (@diraen)

    Switching this to “resolved”

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add a new admin menu linked to a Private Custom Help System’ is closed to new replies.