0
votes

I'm using different post types or categories to determine where to put specific posts on my index.php page for example.

I'd love to add a new entry to my admin menu (like "slider") without using plugins, but only a theme.

I found this in the wordpress documentation which seems to be for plugins - am I right?

If I cannot create an object I'd be interested if it is possible to create an entry in the admin menu which forces a specfific post type or category (hidden).

enter image description here

The following code will add an entry to my "settings / einstellungen" menu tab. However I'd like to position it somewhere else

add_action( 'admin_menu', 'my_plugin_menu' );


function my_plugin_menu() {
    add_options_page( 'Slider', 'Create Slider', 'manage_options', 'create-a-slider', 'my_plugin_options' );
}


function my_plugin_options() {
    if ( !current_user_can( 'manage_options' ) )  {
        wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
    }
    echo '<div class="wrap">';
    echo '<p>Here is where the form would go if I actually had options.</p>';
    echo '</div>';
}
1

1 Answers

0
votes

Actually the link i posted included all the information needed.

The following snippets can be used to attach menus to the different elements. You can use

add_objcect_page()

to add a top level element.

Dashboard 
<?php add_dashboard_page( $page_title, $menu_title, $capability, $menu_slug, $function); ?>


Posts 
<?php add_posts_page( $page_title, $menu_title, $capability, $menu_slug, $function); ?>


Media 
<?php add_media_page( $page_title, $menu_title, $capability, $menu_slug, $function); ?>


Pages 
<?php add_pages_page( $page_title, $menu_title, $capability, $menu_slug, $function); ?>


Comments 
<?php add_comments_page( $page_title, $menu_title, $capability, $menu_slug, $function); ?>


Appearance 
<?php add_theme_page( $page_title, $menu_title, $capability, $menu_slug, $function); ?>


Plugins 
<?php add_plugins_page( $page_title, $menu_title, $capability, $menu_slug, $function); ?>


Users 
<?php add_users_page( $page_title, $menu_title, $capability, $menu_slug, $function); ?>


Tools 
<?php add_management_page( $page_title, $menu_title, $capability, $menu_slug, $function); ?>


Settings 
<?php add_options_page( $page_title, $menu_title, $capability, $menu_slug, $function); ?>

https://codex.wordpress.org/Administration_Menus