Be Part of the Tribe!

    Enjoy free tutorials, share your knowledge!
    Sign up today

    Latest Threads

    Loading products...

Random Post Feed Hack for Sngine

3
2χλμ.
Random Post Feed Hack for Sngine

Random Post Feed Hack for Sngine

 How to Show User Feed Posts Randomly in Sngine

If you want to display user feed posts randomly every time you refresh, like Instagram or Facebook, here’s a quick and simple guide to achieve this in Sngine.

 

See it working here 


Tutorial

1. Locate the Code for Post Ordering

In your Sngine application, navigate to the file

includes/class-user.php.

Find the line of code that controls the order of posts. around line 7191:

$order_query = "ORDER BY posts.post_id DESC";

This line ensures posts are shown in descending order (newest first).

2. Modify the Code to Allow Random Ordering

Replace the line above with the following code:

$order_query = !empty($args['random']) && $args['random'] ? "ORDER BY posts.post_id DESC" : "ORDER BY RAND()";

3. Save and Test

  • Save the changes to class-user.php.

  • Refresh the page and confirm that posts are displayed in a random order every time you refresh.


By modifying the $order_query, you control how posts are ordered in the feed. Using ORDER BY RAND() ensures a different order every time the page is refreshed, creating a dynamic and engaging user experience

Love
1
Προωθημένο
Αναζήτηση
Κατηγορίες
Διαβάζω περισσότερα
Sngine
Does Sngine Really Not Need a Sitemap? Introducing QuickSitemap Addon
Does Sngine Really Not Need a Sitemap?   Sngine, a powerful social network script, has...
από Jane Marcia 2024-12-19 05:11:10 0 2χλμ.
Sngine
How to Optimize Your Sngine Blogs for SEO: A Step-by-Step Guide
Search engine optimization (SEO) is essential for improving the visibility of your content on...
από Jane Marcia 2024-12-08 21:09:08 2 3χλμ.
Marketing
How to stop spammers on Sngine or Wowonder
Spam is a constant problem on Sngine and WoWondee Social Networs, with spammers flooding...
από Jane Marcia 2024-12-21 17:47:08 0 3χλμ.
Seo
Making SEO-Friendly Slugs for Sngine
When it comes to SEO, the structure and length of your URLs play a critical role in your site's...
από Jane Marcia 2025-01-01 07:01:14 0 2χλμ.
Sngine
Random Post Feed Hack for Sngine
 How to Show User Feed Posts Randomly in Sngine If you want to display user feed posts...
από Jane Marcia 2024-12-28 07:39:53 3 2χλμ.