ID of Front-Page
This should do the trick. global $wp_query; $post = $wp_query->get_queried_object(); $post->ID; This’ll give you the ID for each page you’re on. get_option( ‘page_on_front’ ) should’ve worked though.
This should do the trick. global $wp_query; $post = $wp_query->get_queried_object(); $post->ID; This’ll give you the ID for each page you’re on. get_option( ‘page_on_front’ ) should’ve worked though.
Here’s one way using the include with a range from 100 to 200: $user_query = new WP_User_Query( [ ‘include’ => range( 100,200 ) ] );
get_queried_object_id() will return the ID of the current single post or page being viewed, as well as the static front page. For any type of archive page (except date, custom post type and home archives), the following will be returned: Category ID of the category archive being viewed Tag ID of the current tag archive … Read more
I think what you need is: <?php $post_id = $post->ID; //or somehow get the current post ID. $ancestors = get_post_ancestors($post_id) //$ancestors is an array of post IDs starting with the current post going up the root //’Pop’ the root ancestor out or returns the current ID if the post has no ancestors. $root_id = (!empty($ancestors) … Read more
consider to use: $postspage_id = get_option(‘page_for_posts’); and then change the rspective line in your code to: $leftSidebar = get_post_meta( $postspage_id, ‘_my_meta’, true ); from: http://www.blog.highub.com/cms/wordpress/wordpress-front-page-posts-page-id/
Break this down into two parts: First, we create a variable that stores that last-visited page URL, like this: $prev_url = isset($_SERVER[‘HTTP_REFERER’]) ? $_SERVER[‘HTTP_REFERER’] : ”; Then, you could either use substr and strpos to trim down everything between ?= and the / after the ID number. like this: $prev_url=”http://www.yoursite.com/?p=123″; $id_block = substr($prev_url, strpos($prev_url, “?p=”)+1); … Read more