Get the name of menu item with wp_nav_menu

The object_id holds the ID of whatever object the menu item refers to, this will be a post, post etc. The get_queried_object_id() will give you the ID of the current page. $menu_items = wp_get_nav_menu_items( ‘main-menu’ ); $this_item = current( wp_filter_object_list( $menu_items, array( ‘object_id’ => get_queried_object_id() ) ) ); echo $this_item->title;

Using system date format

Calling get_the_date( get_option(‘date_format’) ); will return the exact same value as get_the_date(); this is because by default if a date format is not specified when the function is called it will use get_option(‘date_format’); as can be seen from the following snippet taken from the get_the_date() function itself: if ( ” == $d ) { $the_date … Read more

display a div on ervery site but not frontpage?

You need to tell the PHP to echo the div. if (! is_front_page()) : echo ‘<div class=”button-kontakt”> <a href=”https://wordpress.stackexchange.com/kontakt”><p>ANFRAGE</p></a></div>’; endif; Unless you just want it on the top of the page, you need to add that code to a template file, not the functions file. If it is something that appears at the bottom of … Read more

How to add array [closed]

You don’t need array to do this. The following code will be worked. You have to just add other username also inside if condition with or operation. if (‘plugins.php’ === $pagenow ||’update-core.php’ === $pagenow ) { // wp_safe_redirect( home_url() ); // Now check the current user $user = wp_get_current_user(); if ( $user->user_login == ‘Remo’ || … Read more