Skip to content

Commit

Permalink
0.4.0 add XMLRPC oeru_theme.menu_create
Browse files Browse the repository at this point in the history
Annoying that the theme is called oeru_course, yet all
the options are named oeru_theme*... but this continues
that naming scheme for consistency.

Resolves #1
  • Loading branch information
jimt committed Sep 30, 2015
1 parent a366cba commit 1c6c551
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
32 changes: 32 additions & 0 deletions inc/theme_guidance.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,3 +316,35 @@ function oeru_theme_get_pages_no_parent($post_parent){
}

}

function oeru_theme_menu_create( $args ) {
// require the user to be logged in
global $wp_xmlrpc_server;
$wp_xmlrpc_server->escape( $args );
$blog_id = $args[0];
$user = $args[1];
$pass = $args[2];
if ( ! $user = $wp_xmlrpc_server->login( $user, $pass ) ) {
return $wp_xmlrpc_server->error;
}

// create the menu and install it
$menu_id = oeru_theme_create_menu();
if ( $menu_id == false ) {
wp_delete_nav_menu( "OERu Import Menu" );
$menu_id = oeru_theme_create_menu();
}
oeru_theme_menu_hierarchy($menu_id, 0, 0);
$locations = get_theme_mod( 'nav_menu_locations' );
$locations['primary'] = $menu_id;
set_theme_mod( 'nav_menu_locations', $locations );
return 0;
}

function oeru_theme_xmlrpc_methods( $methods ) {
$methods['oeru_theme.menu_create'] = 'oeru_theme_menu_create';
return $methods;
}

add_filter( 'xmlrpc_methods', 'oeru_theme_xmlrpc_methods' );

2 changes: 1 addition & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Theme Name: OERu Course Theme
Author: Pgogy Webstuff
Author URI: http://pgogywebstuff.com
Description: Open Class Theme for the OERu
Version: 0.3.5
Version: 0.4.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: fixed-layout, responsive-layout, custom-background, custom-header, custom-menu, editor-style, featured-images, flexible-header, full-width-template, rtl-language-support, sticky-post, theme-options
Expand Down

0 comments on commit 1c6c551

Please sign in to comment.