FORUMS
LATEST THREADS

Random Post Feed Hack for Sngine

7
10K
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

Like
Love
4
Sponsored
Search
Categories
Read More
WOWonder
Let’s Fix SEO Issues in Wowonder Blogs and Pages Metadata
If you're running a Wowonder-based social network, you may have noticed some SEO challenges that...
By Jane Marcia 2024-12-11 05:35:56 0 10K
Networking
Why Every WoWonder Website Needs RSS Feeds and Their Benefits
What Is an RSS Feed? RSS feeds are files containing a website’s latest updates in a...
By Jane Marcia 2024-11-24 03:13:49 0 12K
Networking
Expert Website Installation Services: Get Your Site Up and Running Seamlessly
Launching a new website can be overwhelming, especially when you’re trying to set...
By Jane Marcia 2025-02-15 09:55:08 0 4K
Sngine
Sngine Tutorial-HTTP Headers: Let's Enhance Your Website Security with HTTP Headers
Updated Code Suggested by Edy Lee Important: By default, Sngine does not include these essential...
By Jane Marcia 2025-01-24 15:44:43 10 11K
Networking
Responsive Design & Support: The Key to Online Success
In the ever-evolving digital landscape, ensuring that your website looks great and functions...
By Jane Marcia 2025-02-15 09:42:41 0 3K