I have a post list-
<?php
$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'category_name' => 'job',
'posts_per_page' => 20,
'order' => 'ASC',
);
$arr_posts = new WP_Query( $args );
if ( $arr_posts->have_posts() ) :
while ( $arr_posts->have_posts() ) :
$arr_posts->the_post();
?>
<div class="row">
<div class="col-md-5">
<?php
if ( has_post_thumbnail() ) :
the_post_thumbnail();
endif;
?>
</div>
<div class="col-md-7 p-0" id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<h3><?php the_title(); ?></h3>
<p><?php the_content(); ?></p>
<a class="btn btn-blue" title="Read The Coverage" href="https://localhost/fmoc/apply-for-job/" target="_blank" rel="noopener">Apply Now</a>
</div>
</div>
<?php
endwhile;
wp_reset_postdata();
endif; ?>
My all post are redirect on a same page which is an another custom template page. I want the post title on that page. How can I do this.
2
Answers
You can add post title in url parameter.
In other page you will get that parameter in $_REQUEST[‘post_title’].
My proposal is similar to @VimalUsadadiya, but instead of the entire title, I would only add the post ID.
Values before inserting into URL should be escaped, so if you want to insert post title use
urlencode()
functionOn the form page, get ID from url, check it and display the title of the corresponding post:
References: