I am trying to change this wordpress function given in my theme to show posts from category instead of tags.
But due to wordpress beginner i am unable to do this.
Please help me to change this code.
<div id="tabs_content_container2">
<div id="tab3" class="tab_content2" style="display: block;">
<ul class="mv_list_small">
<?php
$orig_post = $post;
global $post;
$tags = wp_get_post_($post->ID);
if ($tags) {
$tag_ids = array();
foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;
$args=array(
'tag__in' => $tag_ids,
'post__not_in' => array($post->ID),
'posts_per_page'=>10, // Number of related posts to display.
'ignore_sticky_posts'=>1
);
$my_query = new wp_query( $args );
$num=1;
while( $my_query->have_posts() ) {
$my_query->the_post();
?>
<li><a href="<?php the_permalink(); ?>">
and after searching on internet i also got the code for related post to show from category. But unable to replace it correctly. Here is the code from internet.
How to show related posts by category
help me to change my default tag code with the category code.
Thank you.