Forum Replies Created

Viewing 2 replies - 16 through 17 (of 17 total)
  • Hello,

    Here is an alternative to put in function.php

    function get_rdr_related_post($post_id){
        $tags = wp_get_post_tags($post_id);
        if ($tags) {
            
            //$first_tag = $tags[0]->term_id;
            $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'    =>3,
                'caller_get_posts'  =>1,
                'meta_key'          => '_thumbnail_id',
                'orderby'           => 'rand',
            );
            $my_query = new WP_Query($args);
            if( $my_query->have_posts() ) {
                while ($my_query->have_posts()) : $my_query->the_post(); ?>
                <div class="col">
                    <a href="<?php echo esc_url( get_permalink() ); ?>">
                        <?php the_post_thumbnail('medium', array('class' => 'rdrit-home-thumbnail-max200') ); ?>
                    </a>
                    <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
                </div>
                <?php
                endwhile;
            }
            wp_reset_query();
        }
    }
    rdrit

    (@rdrit)

    Hi everybody

    I had the same problem, the [toc] tag was not working with default pages and posts, but working very well with CPTs.

    After analyzing the code and options in the database I found the problem.

    At first I used the plugin with the widget for an automatic summary view and I was not using the tag [notoc].

    I then delete the widget from the site leaving the options set …

    To solve the problem, you have to reset the TOC widget, set the options to empty, save and delete the widget.

    Romain

Viewing 2 replies - 16 through 17 (of 17 total)