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
3KB
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
Patrocinado
Pesquisar
Categorias
Leia mais
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...
Por Jane Marcia 2024-12-19 05:11:10 0 2KB
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...
Por Jane Marcia 2024-12-11 05:35:56 0 3KB
Marketing
Email Going to Spam Folder? Here’s How to Fix It with DKIM and DMARC
If your emails are consistently landing in the email spam folder, the culprit is often improper...
Por Jane Marcia 2024-12-20 07:01:27 0 4KB
Networking
The Importance of Having a PWA for Wowonder Site
If you’re running a Wowonder-based social network, you’ve probably noticed how...
Por Jane Marcia 2024-11-25 21:38:11 0 4KB
Literature
Nobody Cares—But You Must Persist, Unseen Battles, Unbreakable Spirit
Nobody Cares—But You Must Persist, Nobody cares, they don’t understand, Your...
Por Jane Marcia 2024-12-11 07:57:03 0 3KB