dev-master
9999999-devAllows a post-like editing experience for post type archives.
MIT
The Requires
- php >=7
by Inpsyde GmbH
0.1.0
0.1.0.0Allows a post-like editing experience for post type archives.
MIT
The Requires
- php >=7
by Inpsyde GmbH
Wallogit.com
2017 © Pedro Peláez
Allows a post-like editing experience for post type archives.
A Composer package that provides a post-like editing experience for post type archives., (*1)
Note: This version of the plugin is not maintained anymore., (*2)
post_type_archive_title and get_the_archive_description to return,
respectively, the title and the excerpt of assigned in backend (if any)."CPT Archives" is not a plugin, but a Composer package. It can be required by themes, plugins or at website level for sites entirely managed by Composer., (*3)
After it is installed via Composer, and composer autoload is required, CPT Archives needs to be bootstrapped, like this:, (*4)
CptArchives\Bootstrap\bootstrap();
functions.php with no need to wrap the call in any hook.After this single line of code is in place, all "CPT Archives" are fully working and its API is available for use., (*5)
There are 2 API, one OOP and one procedural that wraps it., (*6)
OOP API is provided by method of the object CptArchives\Archive which has no public constructor and can be
instantiated using one of its two named constructors:, (*7)
-CptArchives\Archive::for_type() which takes as only argument the post type to build the object for
(as slug, so string, or as post type object).
-CptArchives\Archive::for_current_type() which takes no arguments and only works in post type archive pages
(when is_post_type_archive() is true)., (*8)
Once an instance of the object is obtained, there are following methods available:, (*9)
CptArchives\Archive::archive_title( string $before = '', string $after = '' ): stringCptArchives\Archive::archive_content( string $more_link_text = null, bool $strip_teaser = false ): stringCptArchives\Archive::archive_excerpt(): stringCptArchives\Archive::archive_has_thumbnail(): boolCptArchives\Archive::archive_thumbnail_id(): intCptArchives\Archive::archive_thumbnail( string $size = 'post-thumbnail', array $attr = [] ): stringCptArchives\Archive::archive_meta( string $key = '', bool $single = false ): mixedThe signature is similar to post functions, and the naming should be self-explanatory., (*10)
The procedural API wraps the OOP API with functions in the CptArchives namespace.
API functions are named exactly like CptArchives\Archive object methods., (*11)
The signature is identical, but a parameter is always prepended: the post type to get information from, that can be provided as string (post type slug) or as post type object., (*12)
For example:, (*13)
CptArchives\archive_title( $post_type, string $before = '', string $after = '' ): stringand so on..., (*14)
Note that is also possible to pass null as first argument to API function, and the current post type will be used,
this only work when viewing post type archive in frontend (that is when is_post_type_archive() is true)., (*15)
'cpt-archives.can-edit-archive'. Filter. Allows to edit the capability necessary to edit a Post type archive
(by default $post_type->cap->edit_others_posts).'cpt-archives.can-edit-archive'. Filter. Allows to edit for which post types the library should register
admin screen and API. By default, all public, non builtin, post types that support archives.'cpt-archives.cpt-archive-args' Filter. Allows to edit the registration arguments for the intern CPT used to
manage archives.Via Composer, package name is inpsyde/cpt-archives., (*16)
Copyright (c) since 2017 Inpsyde GmbH., (*17)
"CPT Archives" code is licensed under GPLv2+ license., (*18)
The team at Inpsyde is engineering the Web since 2006., (*19)
Allows a post-like editing experience for post type archives.
MIT
Allows a post-like editing experience for post type archives.
MIT