How to make post clickable and link it with parent post
-
Hello Friends,
I need a small favor by understanding that “how can I make my post clicable and title connected with full details“.
I applied this:
————Start Code—————-
<?php
/*
Template Name: All News Releases Of Posts
*//* This example is for a child theme of Power Mag:
* You’ll need to adapt it the HTML structure of your own theme.
*/get_header();
$pm_full_width = get_post_meta(get_the_ID(), ‘pm_full_width_switch’, true); ?>
<div class=”row”>
<div id=”primary” class=”content-area <?php if ($pm_full_width) { echo ‘span12’; } else { echo ‘span8’; } ?>”>
<div id=”content” class=”site-content” role=”main”><?php while ( have_posts() ) : the_post(); ?>
<?php
// set up or arguments for our custom query
$paged = ( get_query_var(‘paged’) ) ? get_query_var(‘paged’) : 1;
$query_args = array(‘post_type’ => ‘post’,
‘category_name’ => ‘all-news-releases’,
‘posts_per_page’ => 5,
‘paged’ => $paged);
// create a new instance of WP_Query
$the_query = new WP_Query( $query_args );?>
<?php if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); // run the loop ?>
<article>
<h1><?php echo the_title(); ?></h1>
<div class=”excerpt”>
<?php the_excerpt()?></div>
</article>
<?php endwhile; ?><?php if ($the_query->max_num_pages > 1) { // check if the max number of pages is greater than 1 ?>
<nav class=”prev-next-posts”>
<div class=”prev-posts-link”>
<?php echo get_next_posts_link( ‘Older Entries’, $the_query->max_num_pages ); // display older posts link ?>
</div>
<div class=”next-posts-link”>
<?php echo get_previous_posts_link( ‘Newer Entries’ ); // display newer posts link ?>
</div>
</nav>
<?php } ?><?php endif; ?>
<?php if ( has_post_thumbnail() ) : ?>
” title=”<?php the_title_attribute(); ?>”>
<?php the_post_thumbnail(); ?>
<?php endif; ?>
<?php // Load Facebook or WP Comments
$pm_comment_type = get_post_meta(get_the_ID(), ‘pm_comment_type’, true);$url = (!empty($_SERVER[‘HTTPS’])) ? “https://” . $_SERVER[‘SERVER_NAME’] . $_SERVER[‘REQUEST_URI’] : “https://” . $_SERVER[‘SERVER_NAME’] . $_SERVER[‘REQUEST_URI’];
?><?php if ($pm_comment_type == ‘fb’) { ?>
<div class=”fb-comments” data-width=”100%” data-href=”<?php echo $url; ?>” data-num-posts=”4″></div>
<?php } elseif ($pm_comment_type == ‘none’) {
echo ”;
} else {
if ( comments_open() || ‘0’ != get_comments_number() )
comments_template( ”, true );
}
?><?php endwhile; // end of the loop. ?>
</div><!– #content .site-content –>
</div><!– #primary .content-area –><?php if (!$pm_full_width) { ?>
<div class=”span4″><?php get_sidebar(); ?></div>
<?php } ?></div><!– .row (single)–>
<?php get_footer(); ?>
————End Code——————And this how I’m able to bring the single category to desired page.
and this is StartupProficiency.
But title is not clickable and due to this it’s not getting connected to details.Could anyone guide me the perfect code, that can be added to above script.
I just need to make the title clickable or applying ‘more’ at the end of script and rolling to its details.
Thank you for your support….
- The topic ‘How to make post clickable and link it with parent post’ is closed to new replies.