Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #1270393

    Hello all support team and happy Enfold new year :)

    is it possible to leave the same related posts? every time a post is visited the related entries changed. is it possible that they do not change and always leave the same? to have a stable interlinking.

    Thank you!!!

    #1270645

    Hey Ganubis,

    Thank you for the inquiry.

    That is possible but you have to modify the includes > related-posts.php file. Look for this code around line 78..

    array(
                                    'tag__in' => $tag_ids,
                                    'post_type' => get_post_type($this_id),
                                    'showposts'=>$postcount, 'ignore_sticky_posts'=>1,
                                    'orderby'=>'rand',
                                    'post__not_in' => array($this_id))
                                );
    

    .. and remove the orderby parameter. This should automatically fetch the posts based on the date they are published.

    array(
                                    'tag__in' => $tag_ids,
                                    'post_type' => get_post_type($this_id),
                                    'showposts'=>$postcount, 'ignore_sticky_posts'=>1,
                                    'post__not_in' => array($this_id))
                                );
    

    If you want to apply a different value to the orderby and order parameter, please check the following link.

    // https://developer.wordpress.org/reference/classes/wp_query/#order-orderby-parameters

    Best regards,
    Ismael

    #1270969

    Thank you Ismael.

    Work perfect.

    And another related thing. Please:

    Those images of the related post are square 180×180. but I use rectangular images of 833×435, is it possible that the images of the related posts were 345×180? or something to keep the aspect ratio?

    Best regards
    Anubis.

    #1271485

    Hi,

    Glad to know that it is working. :)

    You could use the following plugin to adjust the default size of the thumbnails. The name of the thumbnail size used for the related entries is “square”.

    // https://wordpress.org/plugins/simple-image-sizes/

    The size can be changed in the Settings > Media panel and you have to regenerate or upload the images again afterwards.

    Best regards,
    Ismael

    #1272000

    Hello,

    I have followed all the steps, I have changed it to 345 × 180:

    But for some reason the 180×180 square still shows:

    Thank you very much for your help, Ismael.
    A greeting.

    #1272604

    Hi,

    Thank you for following up.

    Did you regenerate the images after adjusting the thumbnail size? You could also upload the images again manually, but regenerating the images is probably much faster and easier. The thumbnail regeneration option is in the same panel as the thumbnail adjustment options. But if you cannot find it in the same panel, try to install this plugin instead.

    // https://wordpress.org/plugins/regenerate-thumbnails/

    Best regards,
    Ismael

    #1272808

    Hey,

    Yes, the thumbnails are already regenerated at 345×180, and I’ve also seen them on the FTP.

    But I don’t know why they keep showing square.

    Now the code does call the 345×180 images correctly. But it shows them square and squashed.:

    Best regards and thanks!!!

    #1273154

    Hi Ismael

    In the end I have succeeded, I added a new image size, regenerated the thumbnails, and I put this css:

    #top .av-related-style-full .related_image_wrap, #top .av-related-style-full .related_image_wrap img {
        width: 115px !important;
        height: 60px !important;
    }

    it worked but I would like to deactivate the plugin. Is it correct to put it in functions.php child the following code and then desactivate the plugin?

    /* add  related post new size*/
    function ava_image_sizes() { 
    add_image_size('related_post_mini', 115, 60, array('center', 'center'));
    }

    is it correct? oO
    thanks!!!

    • This reply was modified 3 years, 8 months ago by Astrobiologic.
    #1273201

    Hi,

    Did you apply the new thumbnail size related_post_mini to the includes > related-posts.php template? The thumbnail should be specified in this code around line 113.

    $post_thumb = get_the_post_thumbnail($related_post->ID, $image_size, array('title' => esc_attr(get_the_title($post_thumbnail_id))));
    

    Replace $image_size with the new thumbnail.

    $post_thumb = get_the_post_thumbnail($related_post->ID, "related_post_mini", array('title' => esc_attr(get_the_title($post_thumbnail_id))));
    

    Best regards,
    Ismael

    #1273484

    Hi.

    Everything OK. +10

    Thank you very much for all the help Ismael.

    Best regards!!!!!

    #1273507

    Hi,

    I’m glad this was resolved. If you need additional help, please let us know here in the forums.

    Best regards,
    Jordan Shannon

Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘Static related post.’ is closed to new replies.