Coder Social home page Coder Social logo

postie's Introduction

Postie

A WordPress block for fetching posts, pages and custom post types.

screenshot

This plugin just adds the admin UI (i.e renderless block) for creating and managing post blocks, the actual display is up to you.

Features

  • Fetch any posts, pages and custom post types.
  • Filter by any taxonomies, terms and custom fields.
  • Choose specific pages, or show all subpages for said pages.
  • Order by ID, date, modified date, title, slug, menu order, random or custom field.

With postie you can fetch; fantasy books that are less than $20 sorted by price, or properties that feature waterfront views, have 3 or more bedroom and are sorted by land size.

Why

Deferring the display of content means you have complete control over markup, styles and functionality so you can craft the display to suit your needs. For example; if you're showing latest properties you may need to display data like price, location and features, or if you're displaying events you may want to show venue, time, and tickets.

How

Just provide the desired HTML and style the output as you would any other part of your theme. This way you'll always have the cleanest markup and CSS for your needs.

<?php

/**
 * Action to generate the blocks html.
 */
add_action('postie/html', function(WP_Query $query, array $attrs) {
    // Here you actually generate the html from the resulting query.
    // No need to return it, just include your template or echo your content.
}, 10, 2);

/**
 * Filter to optionally modify the main query arguments.
 */
add_filter('postie/query', function(array $args) {
    return array_merge($args, ['author_name' => 'admin']);
});

Notes

Postie requires PHP 7.4+.

postie's People

Contributors

lambry avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.