Custom Walker: how to get ID in function start_lvl

I am making my first custom walker to build an accordion menu. To start with I used this example: http://bitacre.com/2025/custom-nav-menu-walker-for-wordpress-themes There are two functions. First start_lvl and then start_el. In start_el the ID get’s implemented by $item->ID. Does anybody know how I can do this in start_lvl as well? I need to give the (surrounding … Read more

How to get Author ID outside the loop

I can’t get the post author ID outside the loop to make the get_the_author_meta work. So far I’ve tried different approaches: 1. $author_id=$post->post_author; 2. global $post; $author_id=$post->post_author; 3. $post_tmp = get_post($post_id); $author_id = $post_tmp->post_author; 4. $author_id = $posts[0]->post_author; I need the author ID to pass it on to: $address = get_the_author_meta(‘user_email’, $author_id); Any suggestions? 8 … Read more

get post author id outside loop

I need to place in post edit dashboard metabox with post author e-mail (or other user meta fields). So it can be edited when admin reviews this post. $meta_id = get_the_author_meta( ‘user_email’, $user_id ); $meta_box = array( ‘id’ => ‘my-meta-box’, ‘title’ => ‘DANE FIRMY’, ‘page’ => ‘post’, ‘context’ => ‘normal’, ‘priority’ => ‘high’, ‘fields’ => … Read more

how to get page id of a page using page slug

I’m pretty new to WordPress and I was wondering if I could get a page id with its slug. Is it possible please let me know? 7 Use get_page_by_path($page_path): $page = get_page_by_path( ‘about’ ); echo get_the_title( $page ); This will return a regular post object. Documentation: https://developer.wordpress.org/reference/functions/get_page_by_path/ https://developer.wordpress.org/reference/functions/get_the_title/