FORUMS
LATEST THREADS

Random Post Feed Hack for Sngine

7
10KB
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
Commandité
Rechercher
Catégories
Lire la suite
WOWonder
How to Create new Dynamic Page in Wowonder Tutorial
Welcome to this tutorial on creating a new dynamic page in Wowonder! Whether you're looking to...
Par Jane Marcia 2024-12-11 04:37:40 0 10KB
Networking
Cutting-Edge E-commerce Solutions - Expand Your Business Online
In today’s digital marketplace, a strong online presence is essential for any business that...
Par Jane Marcia 2025-02-15 09:47:53 7 3KB
WOWonder
ScriptsTribe: Your Wowonder Help Forum for Support & Add-Ons
  Are you a Wowonder user struggling to find the right solutions, support, or add-ons to...
Par Jane Marcia 2024-11-26 04:37:53 0 10KB
Networking
Business Progressive Web Apps (PWAs)
In today’s digital era, ensuring that your online presence is not only robust but also...
Par Jane Marcia 2025-02-15 09:27:24 0 4KB
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...
Par Jane Marcia 2025-01-01 07:01:14 1 11KB