WP Manifestindependent plugin directory
manifest / developer / wordpress-unique-query

Unique WP Query

A plugin for doing unique WP_Query

by firstandthird · github.com/firstandthird/wordpress-unique-query · website

0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/firstandthird/wordpress-unique-query/archive/refs/heads/main.zip

Readme

unique-wp-query

unique-wp-query is a Wordpress plugin that can be used to ensure no post is loaded more than once per screen

Features

  • ensures only one of each post is loaded

Installation

just put the root folder in your wp-content/plugins directory and Activate from the plugins console

Usage:

From the demo:

$latest_posts1 = new Unique_WP_Query([
  'post_type' => 'post',
  'posts_per_page' => 3,
  'post_status' => 'publish',
  'post__not_in' => array(18)
]);
$latest_posts2 = new Unique_WP_Query([
  'post_type' => 'post',
  'posts_per_page' => 3,
  'post_status' => 'publish',
]);
while ($latest_posts1->have_posts()) {
  $latest_posts1->the_post();
  echo get_the_title(), '<br>';
}
echo "<br><br>---------------------------------------------------------------------<br><br>";
while ($latest_posts2->have_posts()) {
  $latest_posts2->the_post();
  echo get_the_title(), '<br>';
}

The second list will not include any posts that were in the first

Demo:

This repo includes a docker-compose with a dummy theme that demonstrates the plugin, to use it:
    - __docker-compose up__
    - Open a browser and log in to the Wordpress server
    - Add some dummy posts and then load the main page

A First + Third Project

Read the full README on GitHub →

Releases

TagPublished
1.0.0 Nov 10, 2023

These releases are tags only. The author does not attach a packaged zip, so there are no download counts to report.