Skip to content

struct

Posts

pub struct Posts {
    /* private fields */
}

Query parameters for posts and pages (embeds authors, featured images and terms by default).

Methods

new

pub fn new() -> Posts

A query with WordPress's defaults, embedding each post's author, image and terms.

param

pub fn param(self, k: &str, v: &str) -> Posts

Set query parameter k to v, replacing any value it had.

per_page

pub fn per_page(self, n: usize) -> Posts

How many per page (1–100).

page

pub fn page(self, n: usize) -> Posts

Which page (from 1).

search

pub fn search(self, q: &str) -> Posts

Posts matching search q.

slug

pub fn slug(self, slug: &str) -> Posts

The post with slug.

category

pub fn category(self, id: u64) -> Posts

Posts in category id.

tag

pub fn tag(self, id: u64) -> Posts

Posts with tag id.

order_by

pub fn order_by(self, field: &str, ascending: bool) -> Posts

date, modified, title, relevance, …

Trait implementations