Git Product home page Git Product logo

gt-post-lists's Introduction

GT Post Lists

by Jeremy Linder at General Things, Inc.

Introduction

Wordpress has always been a fantastic system for posting timed articles (blogs, if you will). Lately, with the addition of custom post types, Wordpress has become similarly excellent at posting any kind of item you'd like to, with a bit of customization to make it work.

However, problems start arising when you begin to worry about displaying the content in lists. Generally, there are great templating functions to let you loop through different posts and output them, but these have to be done in separate templates, each particular to the posts that are being output. Often, these templates are strikingly similar in actual layout, with the main difference being the post type, of the order. I've done, as I've seen many as well do, which is to read from GET variables in order to figure out what you want to display, but that puts application logic in your layout and that's a MVC no-no.

This plugin was written to address that problem. Using GT Post Lists, you'll be able to, in your post body, change the configuration of your list. Each list is extremely customizable, giving you the ability to create different layouts for different content types and even different "classes" of layouts for all the content type you created.

Examples

[gt-postlist]

This will output the default output of get_posts, but unbounded by the default post # limit.

[gt-postlist type="page"]

This will output all the posts of type "page".

[gt-postlist type="video" size="10" parent="4" exclude="40,50"]

This will output up to 10 posts of type "video", whos parent is id #4, except for posts whos ids are 40 or 50.

I hope you get the general of idea of how it works. Now I shall list the attributes that this function looks for. Please note that it handles these the same way get_posts handles them (as the function wraps around get_posts)

Attributes

"include" = "number, [number, number ...]"

Only show posts specified by the id(s) given

"exclude" = "number, [number, number, ...]"

Only show posts that do NOT include the id(s) given

"parent" = "number, [number, number, ...]"

Only show posts that have a parent whos id is given

"type" = "type_slug"

Only show posts of the type given.

"size" = "number"

Only show up to this number of posts

"meta_key" = "key_string"
"meta_value" = "value_string"

Only show posts that match this meta_key and meta_value combination

"orderby" = "field_name"
"order = "ASC" or "DESC"

Order by the given values in the given direction

"category" = "slug or number, [slug or number, slug or number, ...]"

Only show posts with the categories given by the given slugs and/or numbers. NOTE: It is faster to use ids than it is to use slugs

gt-post-lists's People

Stargazers

Jeremy avatar

Watchers

Jeremy avatar James Cloos 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.