wordpress-menu #56
|
@ -24,13 +24,19 @@ if ($wordpress_endpoint) {
|
||||||
foreach ($response_data as $menu_item) {
|
foreach ($response_data as $menu_item) {
|
||||||
$lowered_title = strtolower($menu_item->title);
|
$lowered_title = strtolower($menu_item->title);
|
||||||
$item_url = $menu_item->url;
|
$item_url = $menu_item->url;
|
||||||
if ($lowered_title == 'login') { // manipulate login url
|
if ($lowered_title == 'login') {
|
||||||
|
// manipulate login url
|
||||||
$item_url = "/login";
|
$item_url = "/login";
|
||||||
}
|
}
|
||||||
$item_title = $menu_item->title;
|
$item_title = $menu_item->title;
|
||||||
if ($lowered_title == 'collections') { // change Collections item
|
if ($lowered_title == 'collections') {
|
||||||
|
if ($wordpress_site) {
|
||||||
|
// change Collections item
|
||||||
$item_title = "Project";
|
$item_title = "Project";
|
||||||
$item_url = $wordpress_site;
|
$item_url = $wordpress_site;
|
||||||
|
} else {
|
||||||
|
continue; // do not render the Collections item
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$item = [
|
$item = [
|
||||||
"id" => $menu_item->ID,
|
"id" => $menu_item->ID,
|
||||||
|
@ -51,18 +57,18 @@ if (count($items[0]) == 0) {
|
||||||
// let's create a default menu
|
// let's create a default menu
|
||||||
if ($wordpress_site) {
|
if ($wordpress_site) {
|
||||||
$project_item = [
|
$project_item = [
|
||||||
"id" => 2,
|
"id" => 1,
|
||||||
"title" => "Project",
|
"title" => "Project",
|
||||||
"url" => $wordpress_site
|
"url" => $wordpress_site
|
||||||
];
|
];
|
||||||
$items[0][2] = $project_item;
|
$items[0][1] = $project_item;
|
||||||
}
|
}
|
||||||
$login_item = [
|
$login_item = [
|
||||||
"id" => 1,
|
"id" => 2,
|
||||||
"title" => "Login",
|
"title" => "Login",
|
||||||
"url" => "/login"
|
"url" => "/login"
|
||||||
];
|
];
|
||||||
$items[0][1] = $login_item;
|
$items[0][2] = $login_item;
|
||||||
}
|
}
|
||||||
//print_r($items);
|
//print_r($items);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue