• Hello sir,
    please change related content from tag to same category

    if (!function_exists(‘mh_magazine_related_content’)) {
    function mh_magazine_related_content() {
    global $post;
    $mh_magazine_options = mh_magazine_theme_options();
    $tags = wp_get_post_tags($post->ID);
    if ($mh_magazine_options[‘related_content’] === ‘enable’ && $tags) {
    $tag_ids = array();
    foreach($tags as $tag) $tag_ids[] = $tag->term_id;
    $related = new wp_query(array(‘tag__in’ => $tag_ids, ‘post__not_in’ => array($post->ID), ‘posts_per_page’ => 3, ‘ignore_sticky_posts’ => 1, ‘orderby’ => ‘rand’));
    if ($related->have_posts()) {
    echo ‘<section class=”mh-related-content”>’ . “\n”;
    echo ‘<h3 class=”mh-widget-title mh-related-content-title”>’ . “\n”;
    echo ‘<span class=”mh-widget-title-inner”>’;
    esc_html_e(‘Related Articles’, ‘mh-magazine’);
    echo ‘</span>’;
    echo ‘</h3>’ . “\n”;
    echo ‘<div class=”mh-related-wrap mh-row clearfix”>’ . “\n”;
    while ($related->have_posts()) : $related->the_post();
    echo ‘<div class=”mh-col-1-3 mh-posts-grid-col clearfix”>’ . “\n”;
    get_template_part(‘content’, ‘grid’);
    echo ‘</div>’ . “\n”;
    endwhile;
    echo ‘</div>’ . “\n”;
    echo ‘</section>’ . “\n”;
    wp_reset_postdata();
    }
    }
    }
    }
    add_action(‘mh_after_post_content’, ‘mh_magazine_related_content’);

Viewing 1 replies (of 1 total)
  • Hey @yemafu,

    Thanks for reaching out to us.

    Please note that most of our customers add links to the categories in their menu. However, they do not add links to tags archive and so we have set the related posts based on tags in order to allow more room for interlinking.

    If you need, you can create a child theme and modify our theme’s function to suit your requirements.

Viewing 1 replies (of 1 total)
  • The topic ‘MH Magazine please change related content from tag to same category’ is closed to new replies.