Have CSS Class Added with `is_page()` WP function

Bitwise operators expect conditionals on either side of them to evaluate to either TRUE or FALSE. If FALSE it checks the next conditional until it finds a TRUE or all conditionals have been checked. Also, the is_page() function doesn’t allow parameters to be passed in on a bitwise basis. So simply change your code to … Read more

Part of Menu Item Hidden on Header Menu

It’s because you’re skewing the parent container with CSS transforms. You can see in this screen capture of developer tools that the parent cuts off the content on the second row. Try this: .menu-primary-menu-container{margin-right:10px;} You’ll see that fixes it, so you just play around with those settings and get it exactly how you want it. … Read more

bootstrap-navwalker will not load

Your register_navwalker function is loading navwalker with this line: require_once get_template_directory() . ‘./class-wp-bootstrap-navwalker.php’; where you concatenate the path of the theme with this string: ‘./class-wp-bootstrap-navwalker.php’ and the dot there at the beginning is a problem. The result would look like this: DOMAIN/wp-content/themes/THEME./class-wp-bootstrap-navwalker.php remove the dot and it should find and load the script. EDIT: Also … Read more

How to make a custom menu based on a category or tag?

You can absolutely have a sidebar widget that shows posts from a certain category. First, set up your new menu. Click on Menus under Appearances. Then click the plus button towards the top right, and give your new menu a name: After you’ve clicked Create Menu, you’ll be taken to a screen to choose what … Read more

Show recent posts in menu?

you can use a walker like this, class Walker_Recent_Post_Category extends Walker_Category { function start_el(&$output, $category, $depth, $args) { extract($args); $cat_name = esc_attr( $category->name); $cat_name = apply_filters( ‘list_cats’, $cat_name, $category ); $list_recent_cat_post=”<ul class=”show-hide”>”; $args = array( ‘numberposts’ => 5, ‘category_name’ => $category->name ); $myposts = get_posts( $args ); foreach( $myposts as $mypost ) : $list_recent_cat_post .= … Read more

How to set classname for tag in wordpress menu?

More easily, you can just enter a unique class name on the admin menu page /wp-admin/nav-menus.php. You may need to look in the top right corner of the page for “Screen Options” and then enable CSS Classes. Then edit any menu item and add the class.

Overriding the currently selected menu item

Since I assume you’re using wp_nav_menu(), there should be a class current_page_parent which is applied to your posts’ page menu item when viewing a single post. You can use this class to style the ‘active’ state, much like you’re probably doing with current_page_item at the moment. If (for whatever reason) you must have current_page_item added … Read more