A right sidebar for Maniapress

Discuss all the publishing tools, including ManiaHome, ManiaPub, ManiaFlash and ManiaPress in this forum

Moderator: NADEO

Post Reply
User avatar
meuh21
Posts: 1266
Joined: 15 Jun 2010, 17:00
Location: Dans mon champ...
Contact:

A right sidebar for Maniapress

Post by meuh21 »

Everything is ready to have a sidebar in Maniapress. So i modify sidebar.php (in fact i copy the main horizontal menu) to have a right sidebar. Then you just have to create a menu called "right" in wordpress and you have a new vertical right menu. I use it for sub-categories in my blog. Take care because i am a noob but it works...

Code: Select all

use ManiaLib\Gui\Manialink;

$layout = new ManiaLib\Gui\Layouts\Column();
$layout->setMarginHeight(1);

Manialink::beginFrame(95, 20, 0.2, 1, $layout);
	{
		// Right vertical menu - menu name : right
		$menu = wp_get_nav_menu_object('right');
		if($menu)
		{
			$menu_items = wp_get_nav_menu_items($menu->term_id);
			foreach((array) $menu_items as $key => $menu_item)
			{
				$title = $menu_item->title;
				$url = $menu_item->url;

				$ui = new ManiaLib\Gui\Elements\Button();
				$ui->setText($menu_item->title);
				$ui->setManialink($menu_item->url);
				$ui->save();
			}
		}
		else
		{
			$ui = new ManiaLib\Gui\Elements\Button();
			$ui->setText('Home');
			$ui->setManialink(maniapress_get_bloginfo('url'));
			$ui->save();
		}
	}
	Manialink::endFrame();
En français : http://www.meuhmania.com/meuhbox/?p=107

Edit : I change $layout->setMarginWidhth(1); by $layout->setMarginHeight(1);
To have a space between the items. Thanks to Kroff who find it :thx:
Post Reply

Return to “Ingame Publishing”

Who is online

Users browsing this forum: No registered users and 1 guest