Commit b3d57b59 authored by Dave Lane's avatar Dave Lane

added cobranding for up to 5 brands, with captions for logos and dynamic...

added cobranding for up to 5 brands, with captions for logos and dynamic layout, replacing prev/next button text, a disclaimer link, and tidied up problem for dark background colours around titles
parent 23443787
......@@ -651,10 +651,10 @@ a.external {
}
/* fix bug issue #45 https://github.com/oeru/oeru_course/issues/45 */
footer#colophon {
/*footer#colophon {
padding-bottom: 0px;
padding-top: 0px;
}
}*/
.main-content .oeru_footer .container {
margin-top: 10px;
......@@ -665,3 +665,26 @@ footer#colophon {
#cookie-notice #cn-notice-text {
margin-bottom: 1em;
}
/* updating for multiple logos! dave@oerfoundation.org 20200609 */
.oeru_footer .logos { width: 100%; padding: 4px; }
.oeru_footer .logos .logo { text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.oeru_footer .logos .logo img { padding: auto; margin: 0px 6px; }
.oeru_footer .logos .logo .caption { color: #aaa; font-size: 80%; margin-top: 6px; }
.oeru_footer .logos { display: grid; grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 960px) {
.oeru_footer .logos { dsplay: grid; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
.oeru_footer .logos { dsplay: grid; grid-template-columns: 1fr; }
}
.oeru_footer .clear { clear: both; }
.oeru_footer .rule { width: 100%; height: 3px; background-color: #ccc; margin: 10px 0 20px 0; }
.oeru_footer .copyright { width: 100%; margin-bottom: 12px; }
.oeru_footer .notices { float: right; text-align: right; }
.oeru_footer .notices a { display: inline; }
/* fix weird title sidebars */
#content header.entry-header {
background-color: transparent; padding-left: 0; padding-right: 0;
}
<?php
define('DEBUGLOG', true);
function debuglog($msg) {
if (DEBUGLOG) {
error_log("**** debug: $msg");
}
}
function oeru_course_admin_page(){
add_menu_page('OERu Theme', 'OERU Theme', 'manage_options', 'oeru-course-admin', 'oeru_course_options');
add_submenu_page('oeru-course-admin', 'Menu Creation', 'Menu Creation', 'manage_options', 'oeru-course-menu', 'oeru_course_menu');
......@@ -176,38 +184,33 @@ allowing it to be targetted as a named anchor.</p>
<?php
}
function oeru_course_create_menu(){
function oeru_course_create_menu() {
$menu_exists = wp_get_nav_menu_object("OERu Import Menu");
if( ! $menu_exists ){
if (!$menu_exists) {
debuglog("creating menu");
$menu_id = wp_create_nav_menu("OERu Import Menu");
return $menu_id;
}else{
return $menu_id;
} else {
debuglog("menu exists");
return false;
}
}
function oeru_course_menu_hierarchy($menu_id, $post_parent, $menu_parent){
function oeru_course_menu_hierarchy($menu_id, $post_parent, $menu_parent) {
debuglog("in oeru_course_menu_hierarchy: menu id ".$menu_id.", post parent ".$post_parent.", menu parent ".$menu_parent.".");
$the_query = new WP_Query( 'posts_per_page=9999&post_type=page&post_parent=' . $post_parent . "&orderby=ID&order=ASC" );
if ( $the_query->have_posts() ) {
while ( $the_query->have_posts() ) {
if ($the_query->have_posts()) {
while ($the_query->have_posts()) {
$the_query->the_post();
$id = get_the_id();
$title = get_the_title();
$item_title = sprintf( __('%s', 'oeru-course'), $title);
$last_page = wp_update_nav_menu_item($menu_id, 0,
array(
'menu-item-title' => printf( __('%s', 'oeru-course'), $title),
'menu-item-classes' => $title,
'menu-item-title' => $title,
'menu-item-classes' => $title." ".$item_title,
'menu-item-object' => 'page',
'menu-item-object-id' => $id,
'menu-item-type' => 'post_type',
......@@ -215,25 +218,22 @@ function oeru_course_menu_hierarchy($menu_id, $post_parent, $menu_parent){
'menu-item-parent-id' => $menu_parent,
)
);
debuglog("menu item: ". $id .", ".$title.", ".$item_title.", ".$last_page."...");
oeru_course_menu_hierarchy($menu_id, $id, $last_page);
}
}
}
function oeru_course_menu(){
if(isset($_POST['menu_create'])){
if(wp_verify_nonce($_POST["oeru_course_menu_create"], "oeru_course_menu_create")){
if($_POST['delete_menu']=="on"){
function oeru_course_menu() {
debuglog("in oeru_course_menu");
if (isset($_POST['menu_create'])) {
debuglog('menu_create');
if (wp_verify_nonce($_POST["oeru_course_menu_create"], "oeru_course_menu_create")) {
debuglog('valid nonce');
if ($_POST['delete_menu']=="on") {
$menu_id = oeru_course_create_menu();
if($menu_id == false){
debuglog('menu_id: ', $menu_id);
if ($menu_id == false) {
wp_delete_nav_menu("OERu Import Menu");
$menu_id = oeru_course_create_menu();
}
......@@ -244,14 +244,11 @@ function oeru_course_menu(){
?><h2>Menu Creation</h2>
<p>Menu Created</p>
<p>Menu can be changed on the <a href='nav-menus.php'>Menu Admin</a> page</p><?php
}else{
} else {
?><h2>Menu Creation</h2><?php
$menu_id = oeru_course_create_menu();
if($menu_id!=false){
if ($menu_id!=false) {
?><p>Menu being created....</p><?php
oeru_course_menu_hierarchy($menu_id, 0, 0);
?><p>Menu Created</p>
......@@ -267,40 +264,27 @@ function oeru_course_menu(){
</form>
<p>Menu can be changed on the <a href='nav-menus.php'>Menu Admin</a> page</p>
<?php
}else{
} else {
?><p>Error - Menu already exists. Please delete "OERu Import Menu" on the <a href='nav-menus.php'>Menu Admin</a> page</p><?php
}
}
}else{
} else {
?><p>Sorry, the nonce did not verify, please refresh the page</p><?php
}
}else if(isset($_POST['menu_primary'])){
if(wp_verify_nonce($_POST["oeru_course_menu_primary"], "oeru_course_menu_primary")){
} else if(isset($_POST['menu_primary'])) {
if (wp_verify_nonce($_POST["oeru_course_menu_primary"], "oeru_course_menu_primary")) {
$locations = get_theme_mod('nav_menu_locations');
$locations['primary'] = $_POST['menu_id'];
set_theme_mod('nav_menu_locations', $locations);
?>
<h2>Menu Creation</h2>
<p>Menu now set as primary</p>
<p>Menu can be changed on the <a href='nav-menus.php'>Menu Admin</a> page</p>
<?php
}else{
} else {
?><p>Sorry, the nonce did not verify, please refresh the page</p><?php
}
}else{
} else {
?><h2>Menu Creation</h2>
<p>If you have ran the script to create the menu, then use this page to create the site menu</p>
<p>The menu at present will look as such. </p>
......@@ -323,14 +307,10 @@ function oeru_course_menu(){
}
function oeru_course_get_pages_no_parent($post_parent){
$the_query = new WP_Query( 'posts_per_page=9999&post_type=page&post_parent=' . $post_parent . "&orderby=ID&order=ASC" );
if ( $the_query->have_posts() ) {
if ($the_query->have_posts()) {
echo "<ul>";
while ( $the_query->have_posts() ) {
while ($the_query->have_posts()) {
$the_query->the_post();
$id = get_the_id();
$title = get_the_title();
......@@ -338,15 +318,13 @@ function oeru_course_get_pages_no_parent($post_parent){
oeru_course_get_pages_no_parent($id);
echo "</li>";
}
echo "</ul>";
}
}
function oeru_course_menu_create( $args ) {
// require the user to be logged in
debuglog("in oeru_course_menu_create");
global $wp_xmlrpc_server;
$wp_xmlrpc_server->escape( $args );
$blog_id = $args[0];
......@@ -358,7 +336,7 @@ function oeru_course_menu_create( $args ) {
// create the menu and install it
$menu_id = oeru_course_create_menu();
if ( $menu_id == false ) {
if ($menu_id == false) {
wp_delete_nav_menu( "OERu Import Menu" );
$menu_id = oeru_course_create_menu();
}
......@@ -370,6 +348,7 @@ function oeru_course_menu_create( $args ) {
}
function oeru_course_xmlrpc_methods( $methods ) {
//debuglog('oeru_course_xmlrpc_methods: '.print_r($methods, true));
$methods['oeru_course.menu_create'] = 'oeru_course_menu_create';
return $methods;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment