Collapsing Categories
Collapsing Categories creates an expandable list of categories and subcategories. It can also expand to show posts. The primary usage is as a widget, but you can also use the code in your theme manually if you wish (see installation instructions) Options Options can be set from the block panel. If you wish to insert the code into your theme manually instead of using a widget, you can use the following options. These options can be given to the collapsCat() function either as an array or in query style, in the same manner as the wp_list_categories function. $defaults=array( 'showPostCount' => true, 'inExclude' => 'exclude', 'inExcludeCats' => '', 'showPosts' => true, 'showPages' => false, 'linkToCat' => true, 'olderThan' => 0, 'excludeAll' => '0', 'catSortOrder' => 'ASC', 'catSort' => 'catName', 'postSortOrder' => 'ASC', 'postSort' => 'postTitle', 'expand' => '0', 'defaultExpand' => '', 'postTitleLength' => 0, 'accordion' => 0, 'catfeed' => 'none', 'taxonomy' => 'category', 'showPostDate' => false, 'postDateAppend' => 'after', 'postDateFormat' => 'm/d', 'useCookies' => true, 'showTopLevel' => true, 'postsBeforeCats' => false, 'expandCatPost' => true, 'debug'=>'0' ); inExclude Whether to include or exclude certain categories ‘exclude’ (default) ‘include’ inExcludeCats The categories which should be included or excluded showPages Whether or not to include pages as well as posts. Default if false linkToCat 1 (true), clicking on a category title will link to the category archive (default) 0 (false), clicking on a category title expands and collapses catSort How to sort the categorys. Possible values: ‘catName’ the title of the category (default) ‘catId’ the Id of the category ‘catSlug’ the url of the category ‘catCount’ the number of posts in the category ‘catOrder’ custom order specified in the categorys settings catSortOrder Whether categories should be sorted in normal or reverse order. Possible values: ‘ASC’ normal order (a-z 0-9) (default) ‘DESC’ reverse order (z-a 9-0) postSort How to sort the posts. Possible values: ‘postDate’ the date of the post (default) ‘postId’ the Id of the post ‘postTitle’ the title of the post ‘postComment’ the number of comments on the post ‘postOrder’ sort by menu order postSortOrder Whether post should be sorted in normal or reverse order. Possible values: ‘ASC’ normal order (a-z 0-9) (default) ‘DESC’ reverse order (z-a 9-0) expand The symbols to be used to mark expanding and collapsing. Possible values: ‘0’ Triangles (default) ‘1’ + – ‘2’ [+] [-] ‘3’ images (you can upload your own if you wish) ‘4’ custom symbols customExpand If you have selected ‘4’ for the expand option, this character will be used to mark expandable link categories customCollapse If you have selected ‘4’ for the expand option, this character will be used to mark collapsible link categories postTitleLength Truncate post titles to this number of characters (default: 0 = don’t truncate) accordion When set to true, expanding one category closes all others at that level catfeed Whether to add a link to the rss feed for a category. Possible values: ‘none’ (default) ‘text’ shows RSS ‘image’ shows an RSS icon taxonomy Type of taxonmy to display. Possible values: ‘category’ (default) ‘link_category’ ‘post_tag’ ‘both’ (categories and tags) any other registered taxononmy (e.g. recipe press uses recipe-categories) showPostDate When true, show the date of each post postDateAppend Show the date before or after the post title. Possible values: ‘after’ (default) ‘before’ postDateFormat What format the post date is in. This uses the standard php date formatting codes useCookies When true, expanding and collapsing of categories is remembered for each visitor. When false, categories are always display collapsed (unless explicitly set to auto-expand). Possible values: 1 (true) (default) 0 (false) showTopLevel When set to false, the top level category will not be shown. This could be useful if you only want to show subcategories from one particular top-level category 1 (true) (default) 0 (false) postsBeforeCats When set to true, posts in category X will be ordered before subcategories of category X 1 (true) 0 (false) (default) expandCatPost When set to true, any category to which a post is assigned will automatically be expanded on a single post page. 1 (true) (default) 0 (false) showEmptyCat When set to true, empty categories are shown 0 (false) (default) 1 (true) debug When set to true, extra debugging information will be displayed in the underlying code of your page (but not visible from the browser). Use this option if you are having problems Examples collapsCat('catSort=ASC&expand=3&inExcludeCats=general,uncategorized') This will produce a list with: * categories shown in alphabetical order * using images to mark collapsing and expanding * exclude posts from the categories general and uncategorized ` ‘postDate’, ‘postSortOrder’ => ‘DESC’, ) ); } else { wp_get_categories(‘your_options_here’); } echo “ \n”; ?> ` Demo I use this plugin in my blog at http://robfelty.com CAVEAT Currently this plugin relies on Javascript to expand and collapse the links. If a user’s browser doesn’t support javascript they won’t see the links to the posts, but the links to the categories will still work (which is the default behavior in wordpress anyways)
Top keywords
- true19×2.36%
- default18×2.24%
- categories16×1.99%
- category16×1.99%
- false12×1.49%
- post12×1.49%
- order9×1.12%
- possible9×1.12%
- possible values9×1.12%
- values9×1.12%
- set8×0.99%
- posts7×0.87%
Content Aware Sidebars – Fastest Widget Area Plugin
Content Aware Sidebars is the #1 WordPress Sidebar Plugin You can optimize conversion rates, boost on-site SEO, upsell products, and much more by displaying different widget areas on different conditions. Create tailored widget areas in seconds. No widget logic coding required. Show or Hide Widgets on Any Page (Yes, any) Replace your theme sidebars on different conditions, or insert widget areas with shortcodes. The following Display Conditions are available out of the box: Posts, Pages & Custom Post Types Content with Tags, Categories, or Custom Taxonomies Content written by select Authors Page Templates Blog Page & Post Type Archives Author Archives Taxonomy Archives Front Page, Search Results, 404 Not Found Page bbPress Profiles, Forums & Topics BuddyPress Profile Sections Languages (Polylang, qTranslate X, TranslatePress, Transposh, Weglot, WPML) Pods Pages You can even combine conditions in any way you like! E.g. target all posts in a select category and written by a specific author. Add Unlimited Sidebars & Widget Areas Create a post sidebar, a page sidebar, a category sidebar, or any custom sidebar you need – no coding required. CAS will never slow down your site, even if you create a lot of custom sidebars and conditions. Sidebars – Quick Select© lets you add or select widget areas directly when editing a post or page. Schedule & Disable Custom Sidebars In the All-in-one Sidebar Manager you just pick a start and end date for when widget areas should be displayed, and CAS will take care of the rest. 1-Click Sidebar Activation© lets you activate or deactivate widget areas instantly. The Most User-friendly Widget Manager When adding new widgets to sidebars, Live Search will find widgets instantly, and the smart split-screen makes it a joy to manage a lot of widgets and sidebars. The Enhanced Widget Manager adds the signature turquoise line to easily identify custom sidebars. Sidebar Plugin Integrations & Support CAS autodetects Custom Post Types and Taxonomies created by any plugin or theme. Built-in support for some of the most popular WordPress plugins means that you e.g. can create WooCommerce sidebars for select products or BuddyPress sidebars for your members. bbPress BuddyPress / BuddyBoss Easy Digital Downloads qTranslate X Pods Polylang TranslatePress Transposh Translation Filter WooCommerce Weglot WPML Customize Your Widget Areas Your Way Without writing any code, you can modify the HTML and CSS classes of widget areas, widgets, and widget titles. You get full control over the look and feel of your sidebars and widget areas, no matter what theme you use. Sidebar Visibility lets you elegantly hide any widget area for logged-out users. Complete control over your WordPress widget areas Upgrade to Content Aware Sidebars Pro and get these additional powerful features: Totem – Smart Floating Button Like the button you may have seen by Intercom or Helpscout, only this is for all your widgets Sticky Sidebars & Widget Areas Make any sidebar or widget area sticky without hurting site performance. No jQuery and no bloat Widget Areas after Paragraphs Display a widget area after a specific number or percentage of paragraphs in your content Even More Display Conditions Advanced Custom Fields data Meta Box data URLs + wildcards Referrer URLs Date Archives & Content by publish date BuddyPress Groups Random Widget Area Designer Add responsive widget columns and edit colors, backgrounds, paddings, etc. Widget Areas in Theme Hooks Intelligently infuse new widget areas into your theme without coding Automatic Widgets Backup Easily restore any changed or deleted widgets Widget Cleaner Save memory and remove clutter by disabling and removing unused widgets Extended User Visibility Show or hide widget areas for User Roles, BuddyPress Groups, and more Time & Weekday Schedule Display widget areas only in select time ranges on given days Container Widget Turn widget areas into reusable blocks and show the same widgets in different places Duplicate Widget Areas A real time-saver when adding new similar widget areas and so much more… Upgrade at anytime instantly and securely from your website’s Admin Dashboard. More Information Documentation GitHub Twitter