I have create two a custom page called page-blogs.php
and page-blog-content.php
.
In the page-blogs.php
I am displaying my all the custom blogs post and page-blog-content.php
will display the blog content.
I am usig below code to display the my all the blog post which is working and i am able to access my blog using this url /
but my issue is with get_permalink($tid)
. When I am clickig on the my post the it's not redirecting on my blog-content.php
page. It is rediecting on wordpress default post(I think single.php) and my URL is shwoing /
$args = array(
'taxonomy' => 'blogs_cat',
'post_type' => 'blog',
'post_status' => 'publish',
'posts_per_page' => 30,
'meta_key' => 'latestblog',
'meta_value' => 1,
'order' => 'DESC'
);
$featured = new WP_Query($args);
$fdata ='';
$fddata = '<div class="main-Blog"><ul>';
while ( $featured->have_posts() ) : $featured->the_post();
$tid = $featured->ID;
$fddata.= '<li> <a href="'.get_permalink($tid).'">
<div class="main-blogBoxwrapper">
<img src="'.get_the_post_thumbnail_url($tid).'">
<div class="blogCatname">
<h6><span>'.$catname.'</span></h6>
<h4>'.wp_trim_words(get_the_title($tid), 14, '...').'</h4>
<p>'.wp_trim_words($get_the_content($tid), 20, '...').'</p>
</div>
</div>
</a></li>';
endwhile;
$fddata.='</ul></div>';
echo $fddata;
I know wordpress also providing the single post and content.php(template-part) but i am using this for my category and subcategory. I have different design for category and for blog post.