Contents
How to get page id outside the loop?
It may not catch every possible permalink (especially since I’m stripping out the query string), but you can modify it to fit your use case. You can use is_page ($page_id) outside the loop to check. This function get id off a page current. I have done it in the following way and it has worked perfectly for me.
How to get the current page id in PHP?
You can get ID of the post in current page outside the loop using the technique below: Chosen answer is working only if you put it in the WordPress loop. Outside it will render useless. In your case you need to get ‘_GET’ and inside ‘post’… The code should look like this: Thanks for contributing an answer to Stack Overflow!
Where is the pageid of the page I’m linking to?
Where PAGEID is the ID of the page I’m linking to. The reason is because I am developing a theme that opens page content in lightboxes, which are triggered by the class in the tag. Below is the code of the custom walker in my functions.php file (after the code I’ll point to the area where I’m having trouble):
How to get the page id of a menu item?
The PAGEID is available in $item->object_id, if $item->object is page. $item->object contains the type of the menu item. Possible values are page, post, category ,…
Is there way to run looping URLs and get data?
By using the filters on the TFS api ive managed to get back a list of all the work items that are relative to a particular project and thier individual URL. Is there a way to make a query similar to what you’ve done above and build a function that iterates through the rows.
How to get the page id in PHP?
First declared a global variable in the header.php, assigning the ID of the post or page before it changes, since the LOOP assigns it the ID of the last entry shown: And to use anywhere in the template, example in the footer.php: This is the correct code.
Is it possible to create a custom WooCommerce product loop?
The downside to a custom WooCommerce loop using any of the methods above is that I’d end up losing the WooCommerce goodies that are baked into WooCommerce’s native loop. I wouldn’t get a nifty ordering dropdown to sort products by various criteria, and I wouldn’t get my much needed pagination.
How to get the post ID from a WP _ query loop?
This retrieves the IDof the current post handled by the loop. You can use it on it’s own if you need it only once: $dish_meta = get_post_meta( get_the_ID(), ‘dish_meta’, true ); You can also store it as a variable if you need it more than once: