You may use $_GET parameter to get the id.
$id = $_GET['id'];
Or try this:
global $post;
echo $post->ID;
But it seems you have a problem in the args array. when you know the exact id of requested post you don’t need to use it like that. you can use this instead:
get_post($id);
And then you do not need to loop through because you have one post to show.
Related Posts:
- Target a specific container to style on WordPress storefront theme
- Switch position of elements in the footer [closed]
- How to display post_content from database in different on template page?
- Add Text Area To Child Theme’s Home Page
- How to include different html tags in the header for different pages?
- Displaying POST content with HTML tags and all
- Use PHP to inject HTML into before page renders?
- Create html tree sitemap
- wordpress form action page not found
- How to make a parent page for author.php?
- Creating Log-In Page for backend server
- Can’t get_users info by using json_encode
- user update profile for custom code
- scroll scrpit to particular button position to next id when click button
- Vertical Menu for one page only
- Bootstrap Carousel Indicators Won’t Cycle On Custom WordPress Theme
- Multisite – Display different header content based on which site is accessed
- Splitting table data to pages with numbers
- Show post/page into div using function
- wordpress, Category ID
- Pass form attributes to another php template in wordpress
- Custom HTML form using PHP – help with ajax/username validation
- Code works on page-example.php by not category-example.php
- html to posts, jpg to featured image, zip file contains jpg and html
- how to remove replicating a tag inside loop?
- How to create a php page to collect information from a html page
- How do you change the tag font size in the repeater-template.php [closed]
- PHP tag in post content makes wordpress go crazy
- Add Alt attribute to image served with php
- Font-Family does not looks like how it should be [closed]
- How to add thumbnails from recent posts to owl-carousel in wordpress automatically?
- How to only fetch certain Tag ID’s
- Where to find the html for WordPress site? [closed]
- Can’t make product images clickable
- Create a hierarchical loop at predefined markup requirements
- I need help implement a Javascript code into the PHP file
- offset and max_num_pages in pagination gallery
- WooCommerce – Print Processing orders [closed]
- RegExp to EXCLUDE strip HTML (FOR SOMME) comments
- Pagination for div’s
- Even with PHP plugin get_posts not working in widget area
- wp nav menu without label
- Category – “No content found”
- Add options to WordPress backend
- Add extra markup to WP menus
- Pass the updated value of aid from form using ajax
- WordPress HTML Helper
- Automatically create a loop for post ID
- echo variable containing html and the_permalink();
- Show contact 7 form in popup
- WordPress – Image href for home menu nav not working
- How Can I Center the Logo in the Navigation Menu? [closed]
- Sort posts by title, sort array by largest number [duplicate]
- nested divs, classes for a grid in loop [duplicate]
- featured post as div background
- Arrange Category post manually when displayed
- Trying to customize wordpress drop down categories
- What is the best way to get the first few post from WordPress in different divs using a loop?
- get_post_meta is always empty when I use wp_mail
- how to manipulate HTML parameters using PHP conditions
- Run php function after html click after page refresh
- Get all the contents of taxonomy and sort by term
- Gallery requires a featured image but does not show it in posts/pages
- Transient Loop Not working as expected
- show/hide attachments
- How to style this wp_list_pages markup
- How To: Simple domPDF Example
- Cant get theme to change footer color through theme customizer
- Display wordpress post to static website in the footer
- Save Option on Database
- How do I modify the with wp_nav_menu()
- Php echo into tag
- Parse error: syntax error, unexpected ‘echo’ (T_ECHO) in C:\xampp\htdocs\AttendanceSystem\resources\php\method.php on line 250 [closed]
- How to edit homepage in WordPress?
- HTML in PHP problem [closed]
- Implement “No related posts for this entry” into the loop?
- ACF repeater image in video poster with jquery
- How to customize posts in WordPress by using HTML and CSS?
- Load Meta box value into div AJAX [duplicate]
- WP_Query not returning results
- How make wp_nav() with my css?
- Header location [closed]
- Can you not edit the HTML and PHP of your WordPress without paying?
- Advanced Custom Fields Show PHP in Text Areas
- How do I link the side images?
- Parse error: syntax error, unexpected ‘}’ in
- Sorting Problem
- Is there a better way to output HTML as a shortcode?
- How to create a container in php then customise it in CSS
- Custom HTML/CSS Theme into WordPress – SEO considerations
- Remove post image caption from post_excerpt();
- Add multiple HTML attributes to an Elementor button
- Load wp_editor on button click
- How to enqueue structured data as file – jsonld file seems not to work
- Find owner of coupon
- Add topbar to static html page
- ‘This Field is Required.’ is Not Displaying on CF7 [closed]
- Slick slider not working on wordpress
- Saving meta box data from selected option’s value in database is not working
- Word press – JSPDF – Sending PDF as attachment from wp_mail – Special characters