r-bouten
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Add page ID to walker function start_lvlHi thnx for the link, in the end I solved in a dirty way for the project I was doing and afterwards never got around redoing it properly. I will have a look at the link. Also here https://wordpress.stackexchange.com/questions/62054/custom-walker-how-to-get-id-in-function-start-lvl/ some solutions where proposed later. Think they are quiet good.
Cheers
Forum: Fixing WordPress
In reply to: Add page ID to walker function start_lvlYes, it’s for wp_nav_menu
Forum: Fixing WordPress
In reply to: Add page ID to walker function start_lvlHi Keessie,
Thank you for your help. There is an ID being displayed now in the right place. Unfortunately it’s not the right ID yet…. It’s the ID of the current page where the menu is displayed not the ID of the page where the walker is walking true. Or how do I explain…. the ID connected to the
<ul>
tag.I found an example with the functionality I need for start_el (where they use
$item->ID
, but I can’t get it implemented the same way in start_lvl.// add main/sub classes to li's and links function start_el( &$output, $item, $depth, $args ) { global $wp_query; $indent = ( $depth > 0 ? str_repeat( "\t", $depth ) : '' ); // code indent // depth dependent classes $depth_classes = array( ( $depth == 0 ? 'accordion-group main-menu-item' : 'sub-menu-item' ), ( $depth >=2 ? 'sub-sub-menu-item' : '' ), ( $depth % 2 ? 'menu-item-odd' : 'menu-item-even' ), 'menu-item-depth-' . $depth ); $depth_class_names = esc_attr( implode( ' ', $depth_classes ) ); // passed classes $classes = empty( $item->classes ) ? array() : (array) $item->classes; $class_names = esc_attr( implode( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) ) ); // build html $output .= $indent . '<li id="nav-menu-item-'. $item->ID . '" class="' . $depth_class_names . ' ' . $class_names . '">'; // link attributes $attributes = ! empty( $item->attr_title ) ? ' title="' . esc_attr( $item->attr_title ) .'"' : ''; $attributes .= ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : ''; $attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : ''; $attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'#collapse'.$item->ID.'"' : ''; $attributes .= ' data-toggle="collapse" ' . ( $depth == 0 ? 'data-parent="#woningmenu"' : 'data-parent="#"' ) . ''; $attributes .= ' class="menu-link ' . ( $depth > 0 ? 'sub-menu-link' : 'main-menu-link' ) . '"'; // build html $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args ); } }
Forum: Fixing WordPress
In reply to: Dynamic sidebar problem: 2nd sidebar not workingYes solved, this plugin was causing the problem.
Forum: Fixing WordPress
In reply to: Dynamic sidebar problem: 2nd sidebar not workingIt’s a site build by somebody else who used a customized twentyten theme. Both sidebars are registered in functions.php.
Nothing is shown in the page source of the site.
Ah, but now I see there is a widget plugin in use. That might cause the problem. I will look into that first. Thanks for the help.
Forum: Fixing WordPress
In reply to: Hide / Exclude Categories From Posts PageI haven’t had time to figure it out yet. But I read in an other thread someone with a similar problem found the solution in updating the MySQL version.
Forum: Fixing WordPress
In reply to: Hide / Exclude Categories From Posts PageInteresting, it influences the order in my news feed but not order in the the category page.
Forum: Fixing WordPress
In reply to: Hide / Exclude Categories From Posts PageI was just working on this as well, but when I exclude a category if changes the post order from oldest to newest. Any clues?
Forum: Fixing WordPress
In reply to: Child page as primary menu itemAllright, thanks for that.
Forum: Fixing WordPress
In reply to: Child page as primary menu itemThnx for your quick reply esmi!
I have set a ‘custom link’ in the menu and it does the job. But I must say it’s not very elegant…. do you know if WordPress supports other ways as well?
Forum: Fixing WordPress
In reply to: show comment to author onlyShine PHP has a nice solution here https://www.shinephp.com/show-to-author-his-posts-comments-only/
Forum: Fixing WordPress
In reply to: show comment to author onlyI am looking for an answer to this question as well. Managed to do this for posts but not for comments yet.
Hope somebody knows how to get around this!