How to get the Clicked ID and output that ID data in another page
I am creating a WordPress theme. I created single.php
, in which I have a button called "Watch Now".
When "Watch Now" is clicked, it gets the ID of the current/clicked post dynamically using the function get_the_ID()
. When it goes to another page (receive.php
), I want to output that ID data, i.e. image of that ID, content of that ID, title and other things. However, when I click "Watch Now", it leads me to receive.php
with this error:
Error 404 - Page Not Found
Receive.php code:
?php get_header(); ?
?php $id = get_the_ID(); ?
?php if (have_posts()) : while (have_posts()) : the_post(); ?
div ?php post_class() ? id="post-?php the_ID(); ?"
h2?php the_title(); ?/h2
?php include (TEMPLATEPATH . '/inc/meta.php' ); ?
div class="entry"
?php the_content(); ?
a href="recieve.php?id=?php echo $id;?"Watch Now/a
?php wp_link_pages(array('before' = 'Pages: ', 'next_or_number' = 'number')); ?
?php the_tags( 'Tags: ', ', ', ''); ?
/div
?php edit_post_link('Edit this entry','','.'); ?
/div
?php comments_template(); ?
?php endwhile; endif; ?
?php get_sidebar(); ?
?php get_footer(); ?
Topic get-the-id theme-development Wordpress
Category Web