0
votes

Im making wordpress theme and I want to make custom page templates in wordpress admin backend. I already made admin menu in functions.php , but where should I add files or do I need to define them to use in wp-admin?

P.S. I dont want to make plugin for that, I want that only my theme would support this so this should be in theme folder.

2

2 Answers

2
votes

You should read the Wordpress Codex.

http://codex.wordpress.org/Administration_Menus

Particularly this part:

    <?php
/** Step 2 (from text above). */
add_action( 'admin_menu', 'my_plugin_menu' );

/** Step 1. */
function my_plugin_menu() {
    add_options_page( 'My Plugin Options', 'My Plugin', 'manage_options', 'my-unique-identifier', 'my_plugin_options' );
}

/** Step 3. */
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>';
}
?>

Although this is plugins: It's a very similar part. You would place the theme part inside your functions.php and use the appropriate hooks found on the codex to implement the extra pages.

 <?php
add_theme_page( $page_title, $menu_title, $capability, $menu_slug, $function );
?> 
-4
votes

You should download free admin panel template. It's much easy to use and customize. Also easy to learn.


Please review this Wordpress Theme.

It's much easier to customize and has lots of features. Also easy to learn code tips.

Regards. HanaTheme.