Link on the featured images

Home Forums GreatMag Link on the featured images

Topic Resolution: Resolved

Tagged: 

This topic contains 21 replies, has 3 voices, and was last updated by  Kharis Sulistiyono 1 week ago.

Viewing 7 posts - 16 through 22 (of 22 total)
  • Author
    Posts
  • #1037390

    zendium
    Participant

    Hello,

    Finally, I have installed a security plugin on my WordpPress…

    I have a last question : Is it possible to display random posts and not the most recent with the plugin :
    – GreatMag: Featured Posts
    – GreatMag: Multiple category posts
    – GreatMag: Posts Carousel

    Thanks,
    Regards

    #1037798

    Hello there,

    To display random post items in those widgets, you’ll need to edit the respective template files.

    GreatMag: Featured Posts

    Edit the greatmag/widgets/widget-featured-posts-a.php file, replace this code block:

    
    $r = new WP_Query( array(
    	'posts_per_page'      => 5,
    	'no_found_rows'       => true,
    	'post_status'         => 'publish',
    	'ignore_sticky_posts' => true,
    	'post__in'	      => $posts
    ) );
    

    with this:

    
    $r = new WP_Query( array(
    	'posts_per_page'      => 5,
    	'no_found_rows'       => true,
    	'post_status'         => 'publish',
    	'ignore_sticky_posts' => true,
    	'post__in'	      => $posts,
    	'orderby'	      => 'rand'
    ) );
    

    To enable random posts, you should define orderby parameter to rand.

    GreatMag: Multiple category posts

    Edit the greatmag/widgets/widget-multiple-cats-posts.php file, replace this code block:

    
    $r = new WP_Query( array(
    	'posts_per_page'      => $number,
    	'no_found_rows'       => true,
    	'post_status'         => 'publish',
    	'ignore_sticky_posts' => true,
    	'cat'		      => $cat			
    ) );
    

    with:

    
    $r = new WP_Query( array(
    	'posts_per_page'      => $number,
    	'no_found_rows'       => true,
    	'post_status'         => 'publish',
    	'ignore_sticky_posts' => true,
    	'cat'		      => $cat,
    	'orderby'	      => 'rand'			
    ) );
    

    GreatMag: Posts Carousel

    Edit the greatmag/widgets/widget-posts-carousel.php and replace this code block:

    
    $r = new WP_Query( array(
    	'posts_per_page'      => $number,
    	'no_found_rows'       => true,
    	'post_status'         => 'publish',
    	'ignore_sticky_posts' => true
    ) );
    

    with:

    
    $r = new WP_Query( array(
    	'posts_per_page'      => $number,
    	'no_found_rows'       => true,
    	'post_status'         => 'publish',
    	'ignore_sticky_posts' => true,
    	'orderby'             => 'rand'
    ) );
    

    Regards,
    Kharis

    #1040017

    zendium
    Participant

    Hello Kharis,

    I forgot to precise : I want to display random posts from only defined category… How can I do this ?

    Best Regards !

    #1040833

    I am sorry, there’s no code solution could be able to accomplish such that objective.

    Regards,
    Kharis

    #1047820

    leo0eloi
    Participant

    Hi! Back to the original question, I do the recomended action, but only eork for the side images, the big one on central page not. And the link on menu is ok. Can see what is the problem please?

    http://www.comunica.fic.ufg.br

    #1049079

    leo0eloi
    Participant

    Hi. I think it’s something with cache on server side. It’s ok now. Closed question again.

    #1050342

    Great! You got it resolved.

    Please let us know in a new topic if you have any other questions.

    Regards,
    Kharis

Viewing 7 posts - 16 through 22 (of 22 total)

You must be logged in to reply to this topic.