Functions php shortcode for displaying main menu with no child items

You could set the ‘depth’ argument to 1 in your wp_nav_menu() call to get only top level items, along with the custom menu walker, something like this: return wp_nav_menu( array( ‘menu’ => $name, ‘menu_class’ => ‘footer-menu’, ‘echo’ => false, ‘depth’ => 1, ‘walker’ => new custom_footer_menu_walker ) ); Add the custom menu walker to your … Read more

Create custom function for hero image

get_the_title() returns the post (product) title including all HTML, whitespaces and symbols not allowed in URLs, etc. Use post slug instead. Also, you don’t need to use any actions. function custom_hero_image( $post_id ) { $product = get_post( $post_id ); $slug = $product->post_name; if ( is_product( $post_id ) ) { $html=”<img class=”jarallax-img” src=””. get_template_directory_uri() .’/inc/assets/img/shop/hero/’.$slug.’.jpg”>’; } … Read more

custom functions in function file delete automatically daily

The simplest advice is that you should never edit what are generally know as Core WordPress files, that includes adding new files within the wp-includes and wp-admin directories. The simple reason why this is not a good idea is that they are replaced when WordPres updates – deleting any changes or additional files – which … Read more

How to Extend login session times to a Month

By default the login cookie lasts for 14 days if you tick ‘remember me’ 48 hours if you don’t So as a short term fix you probably want to tick ‘remember me’, and to extend that to 30 days you can add an auth_cookie_expiration filter e.g. function auth_cookie_expiration_30_days( $seconds, $user_id, $remember_me ) { if ( … Read more