ཞིབ་བརྗོད།
A quick easy way to customize archive pages (or pages with lists of posts like custom post types, categories, tags, or custom taxonomy terms). You can add editable content before or after the list, you can add a featured image. It also allows you to set up the order and pagination on these pages separately from the rest of your site. Taxonomies can share settings across all terms, or have specific settings per term. Administrators can change the settings, site editors can easily change the content.
-
Archive Titles: If your theme is using the_archive_title() function, then you can modify the your archive titles.
- Remove Labels (Archive, Category, Tag, etc.) – Sometimes you just want to get rid of the annoying default words.
- Custom Override – Allow an editor to write something custom for an archive headline.
-
Featured Image: You can allow for a custom featured image that applies to an archive page and have it added above the list automatically, or add it yourself via a theme function.
-
Content Before List: Give your site editors the ability to edit content directly before the archive list. You can have it automatically added, or use a theme function to give you more control over their placement (see the “Other Notes” tab).
-
Content After List: Give your site editors the ability to edit content directly after the archive list. You can have it automatically added, or use a theme function to give you more control over their placement (see the “Other Notes” tab).
-
Archive Order By: Instead of messing with code to change the order of an archive page, now you can do it in a few clicks.
- Date Published
- Title
- Date Modified
- Menu Order
- Random
- ID
- Author
- Post Slug
- Post Type
- Comment Count
- Parent
- Meta Value
- Meta Value (Numeric)
- No Order
-
Archive Order: In addition to the order by setting, you’ll also want to change the sort order direction.
- Ascending
- Descending
-
Archive Pagination: The pagination settings are easy to change without changing code.
- Show Everything
- Custom Posts Per Page
-
Term Edit Options: For categories, tags, and custom taxonomies, you can choose a few additional things.
- Per Term Order & Pagination – Customize the order, and pagination on a per term basis.
- Hide Description Field – You can choose to hide the term description field within the WordPress backend.
- Hide Parent Field – On hierarchal taxonomies, you can choose to hide the parent field within the WordPress backend.
The plugin doesn’t add any CSS or javascript to the front end. The styling of the archive page is left completely up to you. This plugin should be friendly for power users and developers alike. You can use it entirely without changing theme code, or you can control the placement and functionality more exactly using the provided functions. See the “Other Notes” tab.
Have an idea that should be added? Let me know at SwitchWP.
Functions Provided by the Plugin
the_archive_top_content( boolean $html = true )
Displays the top archive content on an archive page. Additional html markup can be removed by setting false.
archive_top_content( boolean $html = true, string $post_type_slug = null, string $term_id = null )
Displays the top archive content for any post type anywhere on the site. Additional html markup can be removed by setting false. Post type is automatic if on an archive page.
get_archive_top_content( string $post_type_slug = null, string $term_id = null )
Returns the top archive content for any post type anywhere on the site. Post type or term id is automatic if on an archive page.
the_archive_bottom_content( boolean $html = true )
Displays the bottom archive content on an archive page. Additional html markup can be removed by setting false.
archive_bottom_content( boolean $html = true, string $post_type_slug = null, string $term_id = null )
Displays the bottom archive content for any post type anywhere on the site. Additional html markup can be removed by setting false. Post type is automatic if on an archive page.
get_archive_bottom_content( string $post_type_slug = null, string $term_id = null )
Returns the top archive content for any post type anywhere on the site. Post type or term id is automatic if on an archive page.
the_archive_thumbnail( string $size = ‘large’, string $post_type_slug = null, string $term_id = null )
Display the archive thumbnail. Default size is large but first parameter can set any valid image size, or an array of width and height values in pixels (in that order). Post type is automatic if on an archive page.
get_archive_thumbnail_src( string $size = ‘large’, string $post_type_slug = null, string $term_id = null )
Returns the archive image url source. Default size is large but first parameter can set any valid image size, or an array of width and height values in pixels (in that order). Post type is automatic if on an archive page.
get_archive_thumbnail_id( string $post_type_slug = null, string $term_id = null )
Returns the archive thumbnail id. if you want to use other common WordPress attachment functions to retrieve data about the image. Post type or term id is automatic if on an archive page.
གཏུབ་རེིས།
སྒྲིག་འཇུག
- Upload the plugin files to the
/wp-content/plugins/archive-control
directory, or install the zipped plugin through the WordPress plugins screen directly. - Activate the Archive Control plugin through the ‘Plugins’ screen in WordPress.
- Use the Settings->Archive Control screen to configure the settings for each custom post type.
- Once you have saved your settings, you can edit the titles, textareas, and featured image in the ‘Edit Archive Page’ submenu for each custom post type, or go to your term edit screens for taxonomies.
FAQ
-
What is an archive page?
-
An archive page is really just WordPress terminology for a page with a list of multiple pieces of content (posts). By default this content is in date order, with the newest appearing at the top, like a blog, and would be split into pages with 10 posts each. WordPress gives you the ability to manipulate this list through code, changing the order, pagination and other characteristics, but doesn’t give you an interface for doing so. WordPress also by default does not have any interface for storing content like images and text that are related to a specific archive page. That is the problem that this plugin tries to provide the solution for.
-
Why won’t my custom post type appear in the Archive Control settings?
-
It depends a lot how your custom post type is created. It must be set to “public”, and it must have “has_archive” set to true, or a string. Be sure to check those settings first!
-
Why can’t I customize the archive title?
-
The archive title functionality requires that a special function is used to display it: the_archive_title(). This is an official WordPress function, but it is relatively new. If your theme does not use this function, and either hardcodes the title or uses a different function, then this plugin won’t be able to help without you modifying the theme template.
-
How do you add in the content before/after archives?
-
The “Automatic” setting uses the “loop_start” and “loop_end” WordPress hooks to inject the content. If you would rather use the “Manual Function” setting, then we give you the functions the_archive_top_content() and the_archive_bottom_content() to place in your theme as you choose.
-
What if I want to change the size of the featured image that is being displayed?
-
This cannot be done through the interface (it shows the “large” size by default), but is entirely possible to do by putting functions in your theme files. The functions provided by this theme are listed in the “Other Notes” tab. For example, the_archive_thumbnail(‘thumbnail’) would change the size to a thumbnail. If you want to create a new size you can either send along an array like this: the_archive_thumbnail(array(500,200)) or register a new size with the add_image_size() functionality.
-
What is a custom post type and how would I make one?
-
A custom post type allows you to make the content adding/editing process more specific for different kinds of content. By default it works similarly to a “Post”, but can be modified to have different settings and even unique custom fields. To create one you could do it several ways:
- Read about it on the Codex: https://codex.wordpress.org/Post_Types
- Use a plugin to create them: https://wordpress.org/plugins/custom-post-type-ui/
- Use a generator website to create them: https://generatewp.com/post-type/
-
What is a custom taxonomy and how would I make one?
-
A custom taxonomy allows you to categorize specific elements separately from others. It works similarly to a “Category” or “Tag”. To create one you could do it several ways:
- Read about it on the Codex: https://codex.wordpress.org/Taxonomies
- Use a plugin to create them: https://wordpress.org/plugins/custom-post-type-ui/
- Use a generator website to create them: https://generatewp.com/taxonomy/
གདེང་འཇོག
བྱས་རྗེས་འཇོག་མཁན། & གསར་འབྱེད་པ།
“Archive Control” is open source software. The following people have contributed to this plugin.
བྱས་རྗེས་འཇོག་མཁན།ཁྱེད་ཀྱི་སྐད་ཡིག་ནང་ལ་ “Archive Control” ཡིག་སྒྱུར་བྱོས།
Interested in development?
Browse the code, check out the SVN repository, or subscribe to the development log by RSS.
དག་བཅོས་ཉིན་ཐོ།
1.3.4
- Minor cosmetic update
1.3.3
- Protect against incorrect users seeing Edit Archive Page Link in WP Admin Bar
1.3.2
- Fixed edit links after some code reorganization
1.3.1
- Fixed a small issue with Term content deletion
1.3.0
- Added feature to customize categories and tags
- Added feature to customize custom taxonomy terms
- Added feature to change all terms within a taxonomy at once, or allow separate settings per term.
- Added feature to hide term description field and term parent field if desired
1.2.1
- SVN issue fix
1.2.0
- Fixed a bug that wouldn’t allow archive featured image functionality unless content before or after was also enabled.
- Introduced basic Taxonomy archive modifications
- Changed the database structure to allow for separation between custom post types and custom taxonomies
1.1.1
- Added a “View Archive Page” link to the edit page
- Added a “Edit Archive Page” link to the admin menu when viewing archive
1.1.0
- Added Archive Featured Image functionality
- Allowed more customization with functions for developers
1.0.0
- Initial Version