Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/devaloka/network-wp-query
:electric_plug: Network-wide WP Query for Multisite environment, which supports POSTS-PER-SITE query etc. [STAND-ALONE][Plugin]
https://github.com/devaloka/network-wp-query
multisite network plugin wordpress wp-query
Last synced: 20 days ago
JSON representation
:electric_plug: Network-wide WP Query for Multisite environment, which supports POSTS-PER-SITE query etc. [STAND-ALONE][Plugin]
- Host: GitHub
- URL: https://github.com/devaloka/network-wp-query
- Owner: devaloka
- License: gpl-2.0
- Created: 2015-12-31T16:11:29.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2020-08-20T21:41:34.000Z (over 4 years ago)
- Last Synced: 2024-11-24T09:42:40.384Z (about 1 month ago)
- Topics: multisite, network, plugin, wordpress, wp-query
- Language: PHP
- Homepage:
- Size: 47.9 KB
- Stars: 16
- Watchers: 4
- Forks: 2
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Network WP Query
[![Latest Stable Version][stable-image]][stable-url]
[![Latest Unstable Version][unstable-image]][unstable-url]
[![License][license-image]][license-url]
[![Build Status][travis-image]][travis-url]A WordPress plugin that provides Network-wide WP_Query for Multisite
environment.This plugin is based on / a improved version of [WP_Query_Multisite](https://github.com/miguelpeixe/WP_Query_Multisite)
(a custom version of [WP_Query_Multisite](https://github.com/ericandrewlewis/WP_Query_Multisite)).## Installation
### Manual Installation
1. Just copy all files into `wp-content/plugins/network-wp-query/`.
### Manual Installation (as a Must-Use plugin)
1. Just copy all files into `wp-content/mu-plugins/network-wp-query/`.
2. Move `network-wp-query/loader/50-network-wp-query-loader.php`
into `wp-content/mu-plugins/`.### Installation via Composer
1. Install via Composer.
```sh
composer require devaloka/network-wp-query
```### Installation via Composer (as a Must-Use plugin)
1. Install via Composer.
```sh
composer require devaloka/network-wp-query
```2. Move `network-wp-query` directory into
`wp-content/mu-plugins/`.3. Move `network-wp-query/loader/50-network-wp-query-loader.php`
into `wp-content/mu-plugins/`.## Example Usage
### Standard Loop
```php
true]); ?>have_posts()): ?>
have_posts()): $query->the_post(); ?>
```
### Query to several specific Sites
```php
true, 'sites__in' => [1, 2, 3]]); ?>have_posts()): ?>
have_posts()): $query->the_post(); ?>
```
### Query excluding several specific Sites
```php
true, 'sites__not_in' => [1, 2, 3]]); ?>have_posts()): ?>
have_posts()): $query->the_post(); ?>
```
### Limit the number of posts per Site
```php
true, 'posts_per_site' => 1]); ?>have_posts()): ?>
have_posts()): $query->the_post(); ?>
```
## Parameters
| Name | Type | Description |
|----------------|:-------:|-------------------------------------------|
| network | boolint | Whether perform network-wide query. |
| sites__in | int[] | Blog IDs to include in the query. |
| sites__not_in | int[] | Blog IDs to excluded from the query. |
| posts_per_site | int | The number of posts per Site to retrieve. |## References
* [ericandrewlewis/WP_Query_Multisite](https://github.com/ericandrewlewis/WP_Query_Multisite)
* [miguelpeixe/WP_Query_Multisite](https://github.com/miguelpeixe/WP_Query_Multisite)
* [#22816 (Multisite WP_Query) – WordPress Trac](https://core.trac.wordpress.org/ticket/22816)[stable-image]: https://poser.pugx.org/devaloka/network-wp-query/v/stable
[stable-url]: https://packagist.org/packages/devaloka/network-wp-query[unstable-image]: https://poser.pugx.org/devaloka/network-wp-query/v/unstable
[unstable-url]: https://packagist.org/packages/devaloka/network-wp-query[license-image]: https://poser.pugx.org/devaloka/network-wp-query/license
[license-url]: https://packagist.org/packages/devaloka/network-wp-query[travis-image]: https://travis-ci.org/devaloka/network-wp-query.svg?branch=master
[travis-url]: https://travis-ci.org/devaloka/network-wp-query