I'm using the built-in Joomla! breadcrumb module, but nothing shows up but "Home" on all my pages.
I looked # the internals of the module, and inside /modules/mod_breadcrumbs/helper.php
$pathway = &$mainframe->getPathway();
$items = $pathway->getPathWay();
When I do a print_r on $items, the only thing in the array is "Home". My menus and sub-menus work fine, my urls show up as http://foobar.com/foo/bar
I failed to set a default menu, this caused all the problems.
I think you need to check your menu structure. I don't remember exactly how the breadcrumbs work, but it should run off the main menu. Do you need to make your menu items sub-menu items of "Home"?
EDIT: on second thoughts, I'm pretty sure it runs off the Section/Category listings. So you'd need to categorise all your articles.
This is joomla 1.5 breadcrumbs concept
$pathway =& $mainframe->getPathway();
$pathway->addItem( JText::_( 'Your Uploads' ),'index.php?option=com_useruploads');
$pathway->addItem('Edit Product');
Related
I'm using Genesis framework and I have this page (http://staging.seedcreativeacademy.co.uk/short-courses/) showing the categories of my custom post type short_courses. I have changed the category name to course_type, by creating a new custom taxonomy.
This is how I want it to work so far (styling needs sorting out admittedly!) Im also using CPT UI plugin.
Now, when I click through to a category, is displays each 'Course in a nice masonry block as you will see here: http://staging.seedcreativeacademy.co.uk/course_type/digital-marketing/
However, I dont want this pages to look like this and I've tried adding custom template for the following:
Archive-short_courses.php & taxonomy-short_courses.php
Archive-course_type.php & taxonomy-course_type.php
But it doesnt seem to alter the layout at all...
Once I pass this hurdle I will want to alter the single.php page for these short courses, but I thought I would start with this first.
Im not sure if genesis blocks this and sets a site wide default? I know if sets a site wide default for the archive settings but I cant find anything about a template, plus i dont know if I shoujld be searching for tutorials on archive.php pages, category.php pager or taxonomy.php pages...
Can someone help me clarify things please?
course_type is a term name, not taxonomy name.
So, these are correct for your case:
category-course_type.php (category-{slug}.php is correct format. So check if course_type is correct slug of that category)
single-short_courses.php
Just in case, try reload permalinks via Settings->permalinks->save after making these changes.
Looks like your theme or some plugin is adding masnory class to body tag, which then is styled by your child theme. You need to filter that class out of your body tag and then might styling goes to non-masonary styling.
Add following code to your taxonomy-course_type.php file, and also make sure you have genesis(); call as the last thing in the template.
add_filter('body_class', 'remove_body_class', 20, 2);
function remove_body_class($wp_classes)
{
foreach($wp_classes as $key => $value)
{
if ($value == 'masonry') unset($wp_classes[$key]);
}
return $wp_classes;
}
Above could should be in custom taxonomy template, which also have genesis(); as last line.
Lots of people, both here on SOW and elsewhere, are having my same exact problem.
I've installed the BBpress plugin on my site here. This plugin enables a FORUM on the site.
I've wrestled for days (to no avail) on this documented issue where the plugin causes the wrong menu item to be highlighted when any Forum sub-menu item is chosen. Instead, the Blog menu item gets highlighted by default.
Check it out: Click on Forum and this resulting page highlights the "Forum" menu item okay. But click on "Test forum" (or drill down into any other Forum item) and the resulting page always has "Blog" highlighted.
Here's what I know so far:
It can't be fixed with CSS alone.
I am using Permalinks (with "Post name" selected)
PHP assigns a .current-menu-item and/or a .current_page_item class (along with their corresponding -ancestor and -parent classes) to menu items based on the page you've navigated to. For some reason, it is failing to see any Forum submenu as a current page. As a result, it is defaulting to "Blog" as the current page item.
So I know I need to do the following:
have Wordpress check the URL upon each page load
if "/forums/" is part of the URL, remove all .current-menu* and .current_page* classes (the wildcard is necessary to purge the ancestor/parent classes).
then assign .current-menu-item and .current_page_item classes to the "Forum" menu item.
The problem is, while I think i'm getting close, I don't know how - exactly - to do this.
I've tried a bunch of things.
I found this Jquery solution but don't know how to implement it, nor am I confident in this approach:
// First add a “forum-class” to your forums menu item in your custom menu
// Then add this to your js file with YOURURL = the url of your site and forums = your forums slug :
$(function() {
var forumURL = window.location.href.indexOf("YOURURL/forums/");
if(forumURL > -1){
$('li.forum-class').addClass('current-menu-item');
}
});
Then, I found this approach which seemed closer to what I wanted, but it introduces a new class and doesn't seem to clear the incorrect classes from the Blog menu. Plus, I don't know where exactly to put this code, or where to create the js file.
if (strtolower($thats_all->post_title) == "forum" || strtolower($thats_all->post_title) == "forums") {
$addclass = ' class="current_page"';
} else {
$addclass = '';
}
Finally, I found this which is what I think I need, but I'm having trouble implementing it (I've tried sticking it in my menu-primary.php and header.php but no go).
// this forces the class current-menu-item to a menu item which I named 'forums'
add_filter('nav_menu_css_class', 'remove_link_parent_menu_classes', 420 ,3);
function remove_link_parent_menu_classes($classes, $item, $args){
if(strpos($item->url, '/forums/') !== true)
return array_diff($classes, array('current_page_item', 'current-menu-item'));
return $classes;
}
I think I'm close. Really close. Just need a push in the right direction. I need to know:
will the latter solution above work?
which file, and where exactly in the file, do I need to place the code?
Thanks!
I finally cracked it! Using the above clues, I figured out this code that worked for me.
add_filter( 'nav_menu_css_class', 'namespace_menu_classes', 10, 2 );
function namespace_menu_classes( $classes , $item ){
if ( get_post_type() == 'forum' ) {
$classes = str_replace( 'current_page_parent', '', $classes );
$classes = str_replace( 'menu-item-16', 'current_page_parent', $classes );
}
return $classes;
}
Copy the above at the end of the function.php file.
Then change 'forum' to the slug name you've chosen and replace 'menu-item-16' with the correctly numbered menu item that you want highlighted (you will need to use your web browser's developer tools to inspect your site to be able to find this).
This took me a week to figure out (and learn the php required)! Good luck and hope this helps everyone else out there.
I developed a component in Joomla! 3, and I used JRoute::_() & router.php to make urls search-engine-friendly. something like this :
/component/products/WIFI-IP-Phone/list-3
So I decided to replace /component/products with a clean alias, And I created a menu with a clean alias to the component home page. now, all the link I have inside the component ( generated with JRoute::_() ) are like this : /escene/WIFI-IP-Phone/list-3 and its perfect, its exactly what I want, But ... I'm using JRoute::_() in three different modules, and I generate links with that, the problem is that generated links in these modules when I'm in the home page or any other page except the component pages, are different with the generated links in these module when I'm in the component pages.
When I'm in the home page or other : /component/products/WIFI-IP-Phone/list-3
When I'm in my component pages : /escene/WIFI-IP-Phone/list-3
Any body can explain the reason Or help me to make all urls like /escene/WIFI-IP-Phone/list-3 ??
This is because the functions you write in components router.php get executed for the links when the page displaying is of the same component. But there is a way to accomplish this task.
1. First create a new menu in the menu manager and create all links in this menu.
2. Publish this menu but do not assign any position.
3. In this way you would get a sef url for each link.
if(JFactory::getConfig()->get('sef')) {
echo 'My sef url';
} else {
echo 'Dynamic url';
}
In this way Joomla will do your url parsing by detecting your component through the alias stored.
Let me know if you have any further query.
I have the problem that I am using a theme where the navigation is simply 'scrolling' to a given part (eg. #contact) when pressed. However, I have implemented some seperate subpages that exits this scrollable page and thus renders the navigation ineffective.
My question is, how can I change the destination of my links or maybe change the menu entirely when users are on these subpages?
I should clarify that all the pages that need 'the new' navigation use a different page template called full_width.php. But since it is using an include header function I can't just replace the navigation.
Thank you for your time!
Here is simple solution based on templates.
if ( is_page_template('full_width.php') ) {
//menu for full width page
} else {
// Returns false when 'full_width.php' is not being used.
wp_nav_menu( $args );//read for args in codex to make menu you want.
}
I am developing a site with Drupal 7. I have styled the menu correctly and all this stuff. The problem is with the secondary menu.
My idea is to create the second menu immediatly behind the first menu, for example:
MENU_ITEM1 | MENU_ITEM2 | MENU_ITEM3 | MENU_ITEM4
MENU_ITEM1_SUBITEM1 | MENU_ITEM1_SUBITEM2 | MENU_ITEM1_SUBITEM3
And the structure goes like this:
MENU_ITEM1
MENU_ITEM1_SUBITEM1
MENU_ITEM1_SUBITEM2
MENU_ITEM1_SUBITEM3
MENU_ITEM2
MENU_ITEM3
MENU_ITEM4
1st problem, I cannot see secondary items
2nd Any suggestion on how to create this?
Thanks a lot!
You can structure your menu with multiple levels within drupal, and select that menu (e.g. main menu) as the source for both your main links and secondary links, over at "/admin/structure/menu/settings".
Then you can implement drupal's theme_preprocess_page() function in your template.php file:
function themeName_preprocess_page(&$vars) {
if (isset($vars['main_menu'])) {
$vars['primary_links'] = theme('links__system_primary_menu', array(
'links' => $vars['main_menu'],
));
}
else {
$vars['primary_links'] = false;
}
if (isset($vars['secondary_menu'])) {
$vars['secondary_links'] = theme('links__system_secondary_menu', array(
'links' => $vars['secondary_menu'],
));
}
else {
$vars['primary_links'] = false;
}
}
Now all you need to do is echo/print the new variables ($primary_links & $secondary_links in this case) now available to page.tpl.php.
Not all drupal themes allow you to style your menus like this.
If you have a theme that supports nested menu structures, you just need to nest your menu items in the menu settings. Fortunately, drupal handles this relatively well thanks to the drag and drop interface, you just need to make sure that any of your top level menu items have the "expanded" box checked.
If you would like to see a quick example, you can just look at your "navigation" menu settings, they are already nested and expanded, so you'll know what your main menu settings should look like.