Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Wordpress in XC 5 ... remove "Blog" from Top Menu

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 10-07-2014, 06:11 AM
 
JannieB JannieB is offline
 

Senior Member
  
Join Date: Sep 2004
Posts: 117
 

Default Wordpress in XC 5 ... remove "Blog" from Top Menu

I have just installed Wordpress extension for XC5 ... all good so far ... as well as a blog I want to use it as a page editor ... a lot easier to set up custom page templates etc ...(more on that story later ...)

... anyway ..

The extension automatically adds "Blog" to the main (ie. top) menu ... I don't want this - how do I stop it??

Thanks,

Jan
__________________
Jan Beesley
(Currently Xcart 5
Previously XCart Gold from 3.5....)
Reply With Quote
  #2  
Old 10-07-2014, 07:52 AM
 
JannieB JannieB is offline
 

Senior Member
  
Join Date: Sep 2004
Posts: 117
 

Default Re: Wordpress in XC 5 ... remove "Blog" from Top Menu

In answer to my own question I sorted it like this:

I added a new class in my custom skin as follows:
Code:
abstract class TopMenu extends \XLite\View\Menu\Customer\Top implements \XLite\Base\IDecorator { /** * Define items * * @return array */ protected function defineItems() { $items = parent::defineItems(); $aNew = array(); foreach ($items as $aItem) { if ($aItem['label'] != static::t('Blog') ) { $aNew[] = $aItem; } } return $aNew; } }

A slightly rubbish way of doing it, but it worked!
__________________
Jan Beesley
(Currently Xcart 5
Previously XCart Gold from 3.5....)
Reply With Quote

The following user thanks JannieB for this useful post:
tony_sologubov (10-14-2014)
  #3  
Old 10-07-2014, 08:17 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: Wordpress in XC 5 ... remove "Blog" from Top Menu

You can just do ... instead of looping through the array and creating new one

PHP Code:
protected function defineItems()
{
    
$items parent::defineItems();
        
        foreach (
$items as $aItem) {
        if (
$aItem['label'] == static::t('Blog')) {
            unset(
$items[$aItem]);
            break;
        }
        }
    
    
// if the array is just a contiguous numeric array you
    // may want to renumber it before the return 
    // array_values($array)
    
return $items;

__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote

The following user thanks cflsystems for this useful post:
JannieB (10-07-2014)
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 02:58 AM.

   

 
X-Cart forums © 2001-2020