How to get page title with the page ID?
My page ID is: 30601. I want to get the page’s title with ID. 2 Try with this: <?php echo get_the_title( $ID ); ?>
My page ID is: 30601. I want to get the page’s title with ID. 2 Try with this: <?php echo get_the_title( $ID ); ?>
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
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
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
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/
How to get current page ID outside the loop? 4 Try global $post; echo $post->ID; or (I don’t know the difference) global $wp_query; echo $wp_query->post->ID;
In WordPress settings you can set a page as the Posts Page. This can be found: WP-Admin->Settings->Reading Settings->Front page displays How do I retrieve the page ID that is set in this setting? 1 Use the page_for_posts option: <?php $page_for_posts = get_option( ‘page_for_posts’ ); ?> This will return the ID of the Page assigned to … Read more