Changeset 2092139
- Timestamp:
- 05/21/2019 09:16:22 AM (7 years ago)
- Location:
- a-z-listing
- Files:
-
- 47 added
- 10 deleted
- 12 edited
-
tags/2.3.0 (added)
-
tags/2.3.0/.distignore (added)
-
tags/2.3.0/.svnignore (added)
-
tags/2.3.0/LICENSE (added)
-
tags/2.3.0/README.md (added)
-
tags/2.3.0/a-z-listing.php (added)
-
tags/2.3.0/changelog.md (added)
-
tags/2.3.0/classes (added)
-
tags/2.3.0/classes/class-a-z-listing-grouping.php (added)
-
tags/2.3.0/classes/class-a-z-listing-indices.php (added)
-
tags/2.3.0/classes/class-a-z-listing-numbers.php (added)
-
tags/2.3.0/classes/class-a-z-listing-singleton.php (added)
-
tags/2.3.0/classes/class-a-z-listing.php (added)
-
tags/2.3.0/css (added)
-
tags/2.3.0/css/a-z-listing-customize.css (added)
-
tags/2.3.0/css/a-z-listing-customize.css.map (added)
-
tags/2.3.0/css/a-z-listing-customize.scss (added)
-
tags/2.3.0/css/a-z-listing-default.css (added)
-
tags/2.3.0/css/a-z-listing-default.css.map (added)
-
tags/2.3.0/css/a-z-listing-default.scss (added)
-
tags/2.3.0/css/mixins.css (added)
-
tags/2.3.0/css/mixins.scss (added)
-
tags/2.3.0/functions (added)
-
tags/2.3.0/functions/enqueues.php (added)
-
tags/2.3.0/functions/health-check.php (added)
-
tags/2.3.0/functions/helpers.php (added)
-
tags/2.3.0/functions/i18n.php (added)
-
tags/2.3.0/functions/scripts.php (added)
-
tags/2.3.0/functions/shortcode.php (added)
-
tags/2.3.0/functions/styles.php (added)
-
tags/2.3.0/interfaces (added)
-
tags/2.3.0/interfaces/interface-a-z-listing-extension.php (added)
-
tags/2.3.0/languages (added)
-
tags/2.3.0/languages/a-z-listing.pot (added)
-
tags/2.3.0/readme.txt (added)
-
tags/2.3.0/scripts (added)
-
tags/2.3.0/scripts/a-z-listing-scroll-fix.js (added)
-
tags/2.3.0/scripts/a-z-listing-tabs.js (added)
-
tags/2.3.0/scripts/a-z-listing-widget-admin.js (added)
-
tags/2.3.0/templates (added)
-
tags/2.3.0/templates/a-z-listing.example.php (added)
-
tags/2.3.0/templates/a-z-listing.php (added)
-
tags/2.3.0/widgets (added)
-
tags/2.3.0/widgets/class-a-z-listing-widget.php (added)
-
tags/2.3.0/wp-includes (added)
-
tags/2.3.0/wp-includes/version.php (added)
-
trunk/.editorconfig (deleted)
-
trunk/.jshintrc (deleted)
-
trunk/.svnignore (modified) (2 diffs)
-
trunk/Gruntfile.js (deleted)
-
trunk/README.md (modified) (19 diffs)
-
trunk/a-z-listing.php (modified) (2 diffs)
-
trunk/changelog.md (modified) (15 diffs)
-
trunk/classes/class-a-z-listing.php (modified) (7 diffs)
-
trunk/composer.json (deleted)
-
trunk/composer.lock (deleted)
-
trunk/docker-compose.yml (deleted)
-
trunk/functions/health-check.php (added)
-
trunk/functions/helpers.php (modified) (1 diff)
-
trunk/functions/shortcode.php (modified) (6 diffs)
-
trunk/languages/a-z-listing.pot (modified) (4 diffs)
-
trunk/package-lock.json (deleted)
-
trunk/package.json (deleted)
-
trunk/phpcs.xml.dist (deleted)
-
trunk/phpunit.xml.dist (deleted)
-
trunk/readme.txt (modified) (19 diffs)
-
trunk/scripts/a-z-listing-tabs.js (modified) (1 diff)
-
trunk/scripts/a-z-listing-widget-admin.js (modified) (2 diffs)
-
trunk/widgets/class-a-z-listing-widget.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
a-z-listing/trunk/.svnignore
r1939419 r2092139 1 1 ._.* 2 2 .DS_Store 3 .editorconfig 3 4 .eslint* 4 5 .git 5 6 .gitignore 6 7 .idea 8 .jshintrc 7 9 .travis.yml 8 10 .vs 11 .vscode 12 *.msbuildproj 9 13 *.phar 10 14 *.sql … … 14 18 assets/ 15 19 bin/ 20 obj/ 16 21 node_modules/ 17 22 vendor/ 23 tests/ 18 24 Dockunit.json 19 phpcs.xml 20 phpunit.xml 25 docker-compose.yml 26 Gruntfile.js 27 phpcs.xml* 28 phpunit.xml* 21 29 Thumbs.db 22 30 wp-cli.local.yml 23 31 package*.json 32 composer.* -
a-z-listing/trunk/README.md
r2056348 r2092139 6 6 **Requires at least:** 4.6 7 7 **Requires PHP:** 5.6 8 **Tested up to:** 5. 19 **Stable tag:** 2. 2.08 **Tested up to:** 5.2 9 **Stable tag:** 2.3.0 10 10 **License:** GPLv2 or later 11 11 **License URI:** http://www.gnu.org/licenses/gpl-2.0.html … … 20 20 Show your posts, pages, and terms alphabetically in a Rolodex-, catalogue-, or directory-style list with the A-Z Listing plugin! 21 21 22 The plugin has a short code for the list, and a widget so you can link to the list from anywhere on your site. If a letter doesn't have any pages then the widget will display the letter unlinked. The list page will omit the display for that letter entirely.22 The plugin has a short-code for the list, and a widget so you can link to the list from anywhere on your site. If a letter doesn't have any pages then the widget will display the letter unlinked. The list page will omit the display for that letter entirely. 23 23 24 24 Show posts from any or multiple post types including the in-built posts and pages. Also supported are post-types from plugins like WooCommerce products. Alternatively, show terms like categories or tags. … … 35 35 ### Instructions ### 36 36 37 1. Upload the `a-z-listing` folder to the `/wp-content/plugins/` directory38 1. Activate the plugin through the 'Plugins' menu in WordPress 39 1. Place `<?php the_a_z_listing(); ?>` in your templates for the index page output (see the **php** section of this document for details) or use the `a-z-listing` shortcode (see the **shortcode** section of this document for details).40 1. Add the A-Z Site Map widget to a sidebar or use `<?php the_a_z_widget( null, array( 'post' => get_page( $id ) ) ); ?>` in your templates (see the **php** section of this document for details).41 42 ## Shortcode ##43 44 The plugin supplies a short code for the full A-Z listing allowing use without modifying your theme's templates.37 1. Upload the a-z-listing folder to the `/wp-content/plugins/` directory. 38 1. Activate the plugin through the 'Plugins' menu in WordPress. 39 1. Use the `[a-z-listing]` short-code on the page or post that you want to show the listing. 40 1. Add the A-Z Site Map widget to a sidebar. 41 42 ## short-code ## 43 44 The plugin supplies a short-code for the full A-Z listing allowing use without modifying your theme's templates. 45 45 46 46 Basic usage is as follows: … … 48 48 [a-z-listing] 49 49 50 To specify a post-type to display instead of `page` then use, e.g. ` Posts`:51 52 [a-z-listing post-type="post"]50 To specify a post-type to display instead of `page` then use, e.g. `post`: 51 52 [a-z-listing display="posts" post-type="post"] 53 53 54 54 To filter the posts by a term from a taxonomy: 55 55 56 [a-z-listing taxonomy="category" terms="my-term-slug"] 56 [a-z-listing display="posts" taxonomy="category" terms="my-term-slug"] 57 58 To display pages that are direct children of the page with ID `24`: 59 60 [a-z-listing display="posts" post-type="page" parent-post="24"] 61 62 To display pages that are children of any depth below the page with ID `24`: 63 64 [a-z-listing display="posts" post-type="page" parent-post="24" get-all-children="yes"] 57 65 58 66 To show terms from a taxonomy instead of posts and pages, e.g. Terms from the `Categories` taxonomy: 59 67 60 [a-z-listing taxonomy="category" display="terms"] 68 [a-z-listing display="terms" taxonomy="category"] 69 70 To show terms from the `Categories` taxonomy that are direct children of the term with ID of `42`: 71 72 [a-z-listing display="terms" taxonomy="category" parent-term="42"] 73 74 To show terms from the `Categories` taxonomy that are children of any depth in the tree below the term with ID of `42`: 75 76 [a-z-listing display="terms" taxonomy="category" parent-term="42" get-all-children="yes"] 61 77 62 78 To override the alphabet used by the plugin: 63 79 64 [a-z-listing alphabet="Aa,Bb,Cc,Dd,Ee,Ff,Gg,Hh,Ii,Jj,Kk,Ll,Mm,Nn,Oo,Pp,Qq,Rr,Ss,Tt,Uu,Vv,Ww,Xx,Yy,Zz"]80 [a-z-listing display="posts" alphabet="Aa,Bb,Cc,Dd,Ee,Ff,Gg,Hh,Ii,Jj,Kk,Ll,Mm,Nn,Oo,Pp,Qq,Rr,Ss,Tt,Uu,Vv,Ww,Xx,Yy,Zz"] 65 81 66 82 To add numbers to the listing: 67 83 68 [a-z-listing numbers="after"]84 [a-z-listing display="posts" numbers="after"] 69 85 70 86 The numbers can also be shown before the alphabet: 71 87 72 [a-z-listing numbers="before"]88 [a-z-listing display="posts" numbers="before"] 73 89 74 90 You can group the numbers into a single collection for all posts beginning with a numeral: 75 91 76 [a-z-listing numbers="after" group ing="numbers"]92 [a-z-listing numbers="after" group-numbers="yes"] 77 93 78 94 To group the alphabet letters into a range: … … 82 98 ** The arguments are all optional ** 83 99 84 * `display`: specifies whether to display posts or terms from a taxonomy 85 * Default value: `posts` 86 * May be set to either `posts` or `terms` 87 * Any value other than unset, `posts` or `terms` will default to displaying posts 88 * `post-type`: sets the listing to show a specific post-type 89 * Default value: `page` 90 * You may specify multiple post-types by separating with commas (`,`) e.g. `post-type="page,post"` 91 * `exclude-posts`: remove specific posts from the list 92 * Default value: unset 93 * Uses the `ID` of the post(s) 94 * Multiple posts may be specified by separating by commas: `,` 95 * Only affects `display="posts"` 96 * `taxonomy`: does nothing by itself, see the combinations below 97 * Default value: unset 98 * Uses the `slug` of the taxonomy 99 * When combined with: 100 * `terms=""`, will filter your posts by the terms you set there, which appear in the taxonomy set here 101 * `display="terms"`, will switch from displaying post titles to displaying the names of terms from the taxonomy specified 102 * `terms`: sets the taxonomy terms for filtering posts 103 * Default value: unset 104 * The taxonomy must also be specified in `taxonomy` 105 * Uses the `slug` of the term(s) when `display="posts"` and the `ID` of the term(s) when `display="terms"` 106 * Multiple terms may be specified by separating with commas: `,` 107 * May not be used with `exclude-terms=""` 108 * `exclude-terms`: sets the terms to exclude from display 109 * Default value: unset 110 * The taxonomy must also be specified in `taxonomy` 111 * Uses the `ID` of the term(s) 112 * Multiple terms may be specified by separating with commas: `,` 113 * May not be used with `terms=""` 114 * Only affects `display="terms"` 115 * `parent-term`: set the parent that all displayed terms must be organised under 116 * Default value: unset 117 * Uses the `slug` of the parent term 118 * Single value only 119 * Only affects `display="terms"` 120 * `hide-empty-terms`: hide terms that have no posts associated 121 * Default value: `false` 122 * May be set to `true` or `1` to hide the empty terms 123 * Only affects `display="terms"` 124 * `numbers`: appends or prepends numerals to the alphabet 125 * Default value: unset 126 * May be set to either `before` or `after` 127 * Any value other than unset, `before` or `after` will default to **appending** numerals to the alphabet 128 * `grouping`: tells the plugin if and how to group the alphabet 129 * Default value: unset 130 * May be set to any positive number greater than `1` or the value `numbers` 131 * Any value other than a positive number or the value `numbers` will default to disabling all grouping functionality 132 * When set to a number higher than `1` the listing will group letters together into ranges 133 * For example, if you chose `3` then a latin alphabet will group together `A`, `B`, and `C` into `A-C`. Likewise for `D-F`, `G-I` and so-on 134 * When using this setting, if numbers are also shown via the `numbers="before"` or `numbers="after"` attribute then they will be shown as a single separate group `0-9` 135 * When set to the value `numbers` it will group numerals into a single group `0-9` 136 * This requires the numbers to be displayed via the `numbers="before"` or `numbers="after"` attributes 137 * `alphabet`: allows you to override the alphabet that the plugin uses 138 * Default value: unset 139 * When this attribute is unset, the plugin will either use the untranslated default, or if [glotpress](https://translate.wordpress.org/projects/wp-plugins/a-z-listing) includes a translation for your site's language as set in `Admin -> Settings -> Site Language` it will use that translation 140 * The current untranslated default is: `AÁÀÄÂaáàäâ,Bb,Cc,Dd,EÉÈËÊeéèëê,Ff,Gg,Hh,IÍÌÏÎiíìïî,Jj,Kk,Ll,Mm,Nn,OÓÒÖÔoóòöô,Pp,Qq,Rr,Ssß,Tt,UÚÙÜÛuúùüû,Vv,Ww,Xx,Yy,Zz` 141 * Accepts a single line of letters/symbols, which need to be separated via the comma character `,` 142 * Including more than one letter/symbol in each group will display posts starting with any of those under the same section 143 * The first letter/symbol in each group is used as the group's heading when displayed on your site 100 ### Common options ### 101 102 * `display`: specifies whether to display posts or terms from a taxonomy. 103 * Default value: `posts`. 104 * May only contain one value. 105 * Must be set to either `posts` or `terms`. 106 * Any value other than `posts` or `terms` will default to displaying posts. 107 * `numbers`: appends or prepends numerals to the alphabet. 108 * Default value: `unset`. 109 * May only contain one value. 110 * Must be set to either `before` or `after`. 111 * Any value other than `before` or `after` will default to **appending** numerals to the alphabet. 112 * `grouping`: tells the plugin if and how to group the alphabet. 113 * Default value: `unset`. 114 * May only contain one value. 115 * Must be set to any positive number greater than `1` or the value `numbers`. 116 * Any value other than a positive number or the value `numbers` will default to disabling all grouping functionality. 117 * When set to a number higher than `1` the listing will group letters together into ranges. 118 * For example, if you chose `3` then a Latin alphabet will group together `A`, `B`, and `C` into `A-C`. Likewise for `D-F`, `G-I` and so-on. 119 * When using this setting, if numbers are also shown via the `numbers="before"` or `numbers="after"` attribute then they will be shown as a single separate group `0-9`. 120 * When set to the value `numbers` it will group numerals into a single group `0-9`. 121 * This requires the numbers to be displayed via the `numbers="before"` or `numbers="after"` attributes. 122 * `group-numbers`: tells the plugin to group all items beginning with a numeral into a single collection. 123 * Default value: `false`. 124 * May only contain one value. 125 * Must be set to `true`, `yes`, `on`, or `1` to group items beginning with a numeral in a single collection. All other values will keep the default behaviour. 126 * `alphabet`: allows you to override the alphabet that the plugin uses. 127 * Default value: `unset`. 128 * When this attribute is not defined, the plugin will either use the untranslated default, or if [glotpress](https://translate.wordpress.org/projects/wp-plugins/a-z-listing) includes a translation for your site's language as set in `Admin -> Settings -> Site Language` it will use that translation. 129 * The current untranslated default is: `AÁÀÄÂaáàäâ,Bb,Cc,Dd,EÉÈËÊeéèëê,Ff,Gg,Hh,IÍÌÏÎiíìïî,Jj,Kk,Ll,Mm,Nn,OÓÒÖÔoóòöô,Pp,Qq,Rr,Ssß,Tt,UÚÙÜÛuúùüû,Vv,Ww,Xx,Yy,Zz`. 130 * Accepts a single line of letters/symbols, which need to be separated via the comma character `,`. 131 * Including more than one letter/symbol in each group will display posts starting with any of those under the same section. 132 * The first letter/symbol in each group is used as the group's heading when displayed on your site. 133 134 ### Posts options ### 135 136 * `post-type`: sets the listing to show a specific post-type. 137 * Default value: `page`. 138 * Multiple post-types may be specified by separating with commas (`,`) e.g. `post-type="page,post"`. 139 * Must be the `slug` of the post-type(s). 140 * `parent-post`: sets the parent post that all displayed posts must be descended from. 141 * Default value: `unset`. 142 * May only contain one value. 143 * Must be the `ID` of the parent post. 144 * Add `get-all-children="yes"` to also include all descendants of any depth below the parent post. 145 * `exclude-posts`: remove these posts from the list. 146 * Default value: `unset`. 147 * Multiple posts may be specified by separating by commas: `,`. 148 * Must be the `ID` of the post(s). 149 * `taxonomy`: sets the taxonomy containing the terms specified in the `terms=""` option. 150 * Default value: `unset`. 151 * May only contain one value. 152 * Must be the `slug` of the taxonomy. 153 * `terms`: sets the taxonomy terms for filtering posts. 154 * Default value: `unset`. 155 * The taxonomy must also be specified in `taxonomy`. 156 * Multiple terms may be specified by separating with commas: `,`. 157 * Must be the `slug` of the term(s). 158 159 ### Terms options ### 160 161 * `taxonomy`: sets the taxonomy to display terms from in the listing. 162 * Default value: `unset`. 163 * Multiple taxonomies may be specified by separating with commas: `,`. 164 * Must be the `slug` of the taxonomy. 165 * `terms`: sets the taxonomy terms to include in the listing. 166 * Default value: `unset`. 167 * The taxonomy must also be specified in `taxonomy`. 168 * Multiple terms may be specified by separating with commas: `,`. 169 * Must be the `ID` of the term(s). 170 * Cannot be used with `exclude-terms=""`. 171 * `exclude-terms`: sets the terms to exclude from display. 172 * Default value: `unset`. 173 * The taxonomy must also be specified in `taxonomy`. 174 * Multiple terms may be specified by separating with commas: `,`. 175 * Must be the `ID` of the term(s). 176 * Cannot be used with `terms=""`. 177 * `parent-term`: set the parent that all displayed terms must be descended from. 178 * Default value: `unset`. 179 * May only contain one value. 180 * Must be the `slug` of the parent term. 181 * Add `get-all-children="yes"` to also include all descendants of any depth below the parent term. 182 * `get-all-children`: when a parent term is chosen this option is used to show all children of any depth or only direct children. 183 * Default value: `false`. 184 * May only contain one value. 185 * Must be set to `true`, `yes`, `on`, or `1` to include all children of any depth. Any value other will use the default behaviour of only showing direct children. 186 * `hide-empty-terms`: hide terms that have no posts associated. 187 * Default value: `false`. 188 * May only contain one value. 189 * Must be set to `true`, `yes`, `on`, or `1` to hide the empty terms. Any other value will use the default behaviour of showing all terms. 190 191 ### Internal-use options for completeness ### 192 193 ** You should not need to touch these, as they are meant for internal use by the plugin only** 194 195 * `target`: the default target for a listing that doesn't show any items. 196 * Default value: `unset`. 197 * May only contain one value. 198 * Must be set to a URL which will be used as the target for the letters' hyperlinks. 199 * `return`: what type of listing to show, either `listing` or `letters`. 200 * Default value: `listing`. 201 * May only contain one value. 202 * Must be set to either `listing` to display the default view, or `letters` to show only the letters without any items (posts or terms). 144 203 145 204 ## PHP ## … … 165 224 Full API documentation is available at [A-Z-Listing Reference](https://a-z-listing.com/reference/) 166 225 167 ## Multi Column Output ##168 169 If you want the multi-column output support, you need to copy the file `a-z-listing-multi-column.example.php` from the plugin inside the `templates` directory to your theme. The file needs to also be renamed to `a-z-listing.php` when copied to your theme. The **Templates and Theming** section of this Document details the functions used within templates and The Loop process this plugin follows.226 ## Multiple Column Output ## 227 228 Multiple column layout is the default on wide screens. A letter's group of items must contain at least 15 items to create two or more columns. This is to provide a more aesthetically pleasing view when a list is short with only a few items. 170 229 171 230 ## Templates and Theming ## … … 185 244 * `$a_z_query->the_letters()` prints the full alphabet, and links the letters that have posts to their section within the index page. 186 245 * `$a_z_query->have_letters()` returns true or false depending on whether there are any letters left to loop-through. This is part of the Letter Loop. 187 * `$a_z_query->have_items()` thisbehaves very similarly to Core's `have_posts()` function. It is part of the Item Loop.246 * `$a_z_query->have_items()` behaves very similarly to Core's `have_posts()` function. It is part of the Item Loop. 188 247 * `$a_z_query->the_letter()` similar to Core's `the_post()`, this will set-up the next iteration of the A-Z Listing's Letter Loop. This needs to wrap-around the Item Loop. 189 248 * `$a_z_query->the_item()` similar to Core's `the_post()`, this will set-up the next iteration of the A-Z Listing's Item Loop, the same way the normal WordPress Loop works. This needs to be _within_ the Letter Loop. … … 191 250 When you are within the Item Loop you may utilise all in-built WordPress Core post-related functions such as `the_content()`. Note that titles and permalinks have helper functions to cope with the A-Z Listing showing taxonomy terms (see the next section). 192 251 193 I advise that you start with a copy of the default template or the multi-columntemplate when customizing your own version. The supplied templates show the usage of most of the functions this plugin provides.252 I advise that you start with a copy of the default template template when customizing your own version. The supplied templates show the usage of most of the functions this plugin provides. 194 253 195 254 ### Helper functions ### … … 210 269 ### Why is the list layout completely broken? ### 211 270 212 If you are using a page-builder such as WPBakery or Elementor you need to ensure that you put the short code into a normal text area. Placing the shortcode into a preformatted text area will add `<pre>` tags around the listing output. These extra tags break the layout considerably.271 If you are using a page-builder such as WPBakery or Elementor you need to ensure that you put the short-code into a normal text area. Placing the short-code into a preformatted text area will add `<pre>` tags around the listing output. These extra tags break the layout considerably. 213 272 214 273 ### Why is my list in a single column? ### 215 274 216 The list of items under each letter heading needs to have at least 11 items for a second column to be created. Once you hit the magic 11 items, the list will break into two columns with 6 items in the first column and 5 items in the second. When you get to 21 items a third column will be added if there is room on your page; and so-on up to a maximum of 15 columns if there is enough space, though it is unexpected that any web page be wide enough for more than a few columns to fit. The columns will fill-up evenly once you have more than one column on the page.217 218 ### How do I show posts of a different post-type (not pages) or multiple post-types (e.g. posts AND pages) ###219 220 This can be achieved using the short code or PHP. In these examples the generic phrase `post-type-slug` is used to describe the concept. The default post types provided by WordPress are called "Posts" and "Pages". Their slugs are `post` and `page` respectively. You need to use these names in place of the examples (i.e. `your-post-type-slug`, `type1-slug`, and `type1-slug`).221 222 #### Shortcode method ####275 The list of items under each letter heading needs to have at least 11 items for a second column to be created. Once you hit the magic 11 items, the list will break into two columns with 6 items in the first column and 5 items in the second. When you get to 21 items a third column will be added if there is room on your page; and so-on up to a maximum of 15 columns if there is enough space, though it is unexpected that any web-page be wide enough for more than a few columns to fit. The columns will fill-up evenly once you have more than one column on the page. 276 277 ### How do I show posts of a different post-type (not pages) or multiple post-types (e.g. posts AND pages)? ### 278 279 This can be achieved using the short-code or PHP. In these examples the generic phrase `post-type-slug` is used to describe the concept. The default post types provided by WordPress are called "Posts" and "Pages". Their slugs are `post` and `page` respectively. You need to use these names in place of the examples (i.e. `your-post-type-slug`, `type1-slug`, and `type1-slug`). 280 281 #### short-code method #### 223 282 224 283 ##### Single post-type ##### … … 234 293 #### PHP method #### 235 294 236 PHP code needs to be added to your theme files, and cannot be used as post or page content in the way that a short code can.295 PHP code needs to be added to your theme files, and cannot be used as post or page content in the way that a short-code can. 237 296 238 297 ##### Single post-type ##### … … 260 319 The code above needs to be within a php block which is denoted by the `<?php` and `?>` pair. Depending on your theme, you might not need the opening and closing php tags shown in the above snippet; if that is the case, you are free to omit them in your code. 261 320 262 ### How do I show posts from a specific category only ###263 264 This can be achieved using the short code or PHP. In these examples the generic phrase `taxonomy` and `term` are used to describe the concept. The default taxonomies provided by WordPress are called "Categories" and "Tags". Their slugs are `category` and `post_tag` respectively. Each Category and Tag are then known as "terms". You need to use the slug for each individual category or tag in place of the example slugs (i.e. `term-slug`, `term1-slug`, and `term1-slug`).265 266 #### Shortcode method ####321 ### How do I show posts from a specific category only? ### 322 323 This can be achieved using the short-code or PHP. In these examples the generic phrase `taxonomy` and `term` are used to describe the concept. The default taxonomies provided by WordPress are called "Categories" and "Tags". Their slugs are `category` and `post_tag` respectively. Each Category and Tag are then known as "terms". You need to use the slug for each individual category or tag in place of the example slugs (i.e. `term-slug`, `term1-slug`, and `term1-slug`). 324 325 #### short-code method #### 267 326 268 327 ##### Single term ##### … … 278 337 #### PHP method #### 279 338 280 PHP code needs to be added to your theme files, and cannot be used as post or page content in the way that a short code can.339 PHP code needs to be added to your theme files, and cannot be used as post or page content in the way that a short-code can. 281 340 282 341 ```php … … 298 357 The code above needs to be within a php block which is denoted by the `<?php` and `?>` pair. Depending on your theme, you might not need the opening and closing php tags shown in the above snippet; if that is the case, you are free to omit them in your code. 299 358 300 ### How do I show terms from a taxonomy instead of posts ###301 302 This can be achieved using the short code or PHP. In these examples the generic phrase `taxonomy` and `term` are used to describe the concept. The default taxonomies provided by WordPress are called "Categories" and "Tags". Their slugs are `category` and `post_tag` respectively. You need to use the slug for the taxonomy in place of the example slugs (i.e. `taxonomy-slug`).303 304 #### Shortcode method ####359 ### How do I show terms from a taxonomy instead of posts? ### 360 361 This can be achieved using the short-code or PHP. In these examples the generic phrase `taxonomy` and `term` are used to describe the concept. The default taxonomies provided by WordPress are called "Categories" and "Tags". Their slugs are `category` and `post_tag` respectively. You need to use the slug for the taxonomy in place of the example slugs (i.e. `taxonomy-slug`). 362 363 #### short-code method #### 305 364 306 365 [a-z-listing taxonomy="taxonomy-slug" display="terms"] … … 312 371 #### PHP method #### 313 372 314 PHP code needs to be added to your theme files, and cannot be used as post or page content in the way that a short code can.373 PHP code needs to be added to your theme files, and cannot be used as post or page content in the way that a short-code can. 315 374 316 375 ```php … … 326 385 ### How do I remove section targeting or limit which sections are available? ### 327 386 328 In your theme's functions.phpadd the following code:387 In your theme's `functions.php` file add the following code: 329 388 330 389 ```php … … 340 399 ### I am not using the short-code so the styles are not working, can I still use the in-built styles without the short-code? ### 341 400 342 Yes you can. This needs the following code added to your theme's functions.php. We purposely only display the stylesheet on pages where the short-code is active.401 Yes you can. This needs the following code added to your theme's `functions.php` file. We purposely only display the stylesheet on pages where the short-code is active. 343 402 344 403 ```php … … 348 407 ``` 349 408 350 If there is code already in your functions.phpthen add just the lines between `<?php` and `?>` on the line directly after the very first instance of `<?php`.409 If there is code already in your theme's `functions.php` file then add just the lines between `<?php` and `?>` on the line directly after the very first instance of `<?php`. 351 410 352 411 The sidebar widget styling also works in a similar manner, and will also respond to the same code above to forcibly enable it. … … 366 425 ``` 367 426 368 If there is code already in your functions.phpthen add just the lines between `<?php` and `?>` on the line directly after the very first instance of `<?php`.427 If there is code already in your theme's `functions.php` file then add just the lines between `<?php` and `?>` on the line directly after the very first instance of `<?php`. 369 428 370 429 ### How do I disable the in-built styling? ### … … 403 462 ## Changelog ## 404 463 464 ### 2.3.0 ### 465 466 * Add multiple taxonomy support to taxonomy terms listing. 467 * Add site health-check feature compatibility. 468 * Fix `hide-empty-terms` in a taxonomy terms listing. Previously completely broken. 469 * Fix hard-coded `admin-ajax.php` URL in widget configuration javascript. 470 * Improve documentation in the readme.txt file, which is shown on the plugin page at WordPress.org. 471 405 472 ### 2.2.0 ### 406 473 407 474 * Add `get_the_item_post_count` and `the_item_post_count` template methods to get or display the number of posts associated with a term. 408 475 * Add support for `get-all-children` when specifying a `parent-term`. 409 * Add extra filename for template matching: `a-z-listing-$slug.php` where `$slug` is the slug of the post containing the short code.476 * Add extra filename for template matching: `a-z-listing-$slug.php` where `$slug` is the slug of the post containing the short-code. 410 477 * Deprecate PHP 5.3-5.5. Please ensure you are running at least PHP 5.6. The plugin may work on older PHP versions, but compatibility is not guaranteed. 411 * Bugfix for incorrect behaviour of `exclude-terms` in the shortcode. Thanks go to Chris Skrzypchak for finding this. 412 413 ### 2.1.4 ### 414 415 #### Bug Fix #### 416 417 * Fixed a spurious `NOTICE` message (shown below) when error logging is output to the browser. Thanks to the discovery by @npiper. 418 * If your site is not showing the message below then you do not need to upgrade with any urgency. 419 420 `Notice: Trying to get property of non-object in [Path-to-WordPress]/wp-content/plugins/a-z-listing/classes/class-a-z-listing.php on line 215` 421 422 ### 2.1.3 ### 423 424 #### Bug Fix #### 425 426 * Fixed the bug reported by @ighosts22 where the letter for non-alphabetic items was not pointing at the list of items. 427 * Fixed incorrect behaviour discovered after adding tests to the automated testing to verify that I correctly fixed the above bug. 428 429 ### 2.1.2 ### 430 431 #### Bug Fix #### 432 433 * Post links in 2.1.0 and 2.1.1 included a series of `%09` which caused visitors' clicks to return a 404 Not Found error. Thanks to @forestpump for their effort in finding the problem and highlighting the fix. 434 435 ### 2.1.1 ### 436 437 #### Bug Fix #### 438 439 * Replace hardcoded path to `admin-ajax.php` in widget administration javascript. 440 * This release fixes the widget administration form for sites running in a path similar to https://example.com/wp/. You should install this fix if your site is a configured in a subfolder to be able to successfully configure the widget. 441 * Sites running in the top-level, e.g. https://example.com/, already work correctly and their behaviour is unchanged by this fix. You do not need to hurry to update if your site is configured at the top-level without a subfolder. 442 443 ### 2.1.0 ### 444 445 #### Bug Fixes #### 446 447 * Fix widget configuration autocomplete fields for target post and parent post in the theme customizer 448 * Fix taxonomy-term-filtered listings displaying all posts (e.g. shortcodes of the form `[a-z-listing taxonomy="category" terms="term"]) 449 * Fix `get_the_item_object()` to work with old-style overridden indices 450 * Fix `get_the_item_object()` to correctly extract the item ID and load the correct item 451 * Improve javascript on the widget configuration 452 * Clarified the examples with explanations about "post types", "taxonomies", and "terms" to explain what each of these mean. 453 454 #### New Features #### 455 456 * Add parent-page attribute to the shortcode 457 * Add simpler and safer filter for overriding the index letter for an item 458 * Add simpler and safer filter for overriding the title for an item 459 * Add new function for fetching meta data in a template: `$a_z_listing->get_item_meta()` 460 * Allow exclude-terms to be used with display="posts" 461 * Moved template loading function outside of the `A_Z_Query` class to prevent accidental access to the plugin internal structure 462 463 ### 2.0.6 ### 464 465 * Fix widget target post support 466 * Fix filtering posts by multiple taxonomy terms 467 * Fix styling error causing two or more posts to sometimes appear on the same line 468 * Minor style tweak to fix short listings, and long titles 469 * Fix broken styling in 2.0.0 470 * Fix javascript error on widgets screen 471 472 ### 2.0.0 ### 473 474 * Improved widget configuration. 475 * New attribute added to the shortcode when `display="posts"`: 476 * `exclude-posts`: remove specific posts from the list 477 * New attributes added to the shortcode when `display="terms"`: 478 * `exclude-terms`: sets the terms to exclude from display 479 * `parent-term`: set the parent that all displayed terms must be organised under 480 * `hide-empty-terms`: hide terms that have no posts associated 481 * Fix the stylesheet to better cope with variances in font-size and text length in the alphabet links list and widget. 482 * Introduce PHP classes for adding numbers and grouping to the alphabet. Allows unhooking from the filters to undo the changes, where previously you could not unhook these modifications once they'd been applied. 483 484 #### BREAKING CHANGES #### 478 * Bugfix for incorrect behaviour of `exclude-terms` in the short-code. Thanks go to Chris Skrzypchak for finding this. 479 480 ### BREAKING CHANGES in 2.0.0+ ### 485 481 486 482 ##### Multi column example ##### -
a-z-listing/trunk/a-z-listing.php
r2056348 r2092139 8 8 * Text Domain: a-z-listing 9 9 * Domain Path: /languages 10 * Version: 2. 2.010 * Version: 2.3.0 11 11 * 12 12 * @package A_Z_Listing … … 33 33 function a_z_listing_plugins_loaded() { 34 34 require 'functions/i18n.php'; 35 require 'functions/health-check.php'; 35 36 require 'functions/helpers.php'; 36 37 require 'functions/styles.php'; -
a-z-listing/trunk/changelog.md
r2056348 r2092139 1 1 # Full Changelog # 2 3 ## 2.3.0 ## 4 5 * Add multiple taxonomy support to taxonomy terms listing. 6 * Add site health-check feature compatibility. 7 * Fix `hide-empty-terms` in a taxonomy terms listing. Previously completely broken. 8 * Fix hard-coded `admin-ajax.php` URL in widget configuration javascript. 9 * Improve documentation in the readme.txt file, which is shown on the plugin page at WordPress.org. 2 10 3 11 ## 2.2.0 ## … … 5 13 * Add `get_the_item_post_count` and `the_item_post_count` template methods to get or display the number of posts associated with a term. 6 14 * Add support for `get-all-children` when specifying a `parent-term`. 7 * Add extra filename for template matching: `a-z-listing-$slug.php` where `$slug` is the slug of the post containing the short code.15 * Add extra filename for template matching: `a-z-listing-$slug.php` where `$slug` is the slug of the post containing the short-code. 8 16 * Deprecate PHP 5.3-5.5. Please ensure you are running at least PHP 5.6. The plugin may work on older PHP versions, but compatibility is not guaranteed. 9 * Bugfix for incorrect behaviour of `exclude-terms` in the short code. Thanks go to Chris Skrzypchak for finding this.17 * Bugfix for incorrect behaviour of `exclude-terms` in the short-code. Thanks go to Chris Skrzypchak for finding this. 10 18 11 19 ## 2.1.4 ## 12 13 ### Bug Fix ###14 20 15 21 * Fixed a spurious `NOTICE` message (shown below) when error logging is output to the browser. Thanks to the discovery by @npiper. … … 20 26 ## 2.1.3 ## 21 27 22 ### Bug Fix ###23 24 28 * Fixed the bug reported by @ighosts22 where the letter for non-alphabetic items was not pointing at the list of items. 25 29 * Fixed incorrect behaviour discovered after adding tests to the automated testing to verify that I correctly fixed the above bug. … … 27 31 ## 2.1.2 ## 28 32 29 ### Bug Fix ###30 31 33 * Post links in 2.1.0 and 2.1.1 included a series of `%09` which caused visitors' clicks to return a 404 Not Found error. Thanks to @forestpump for their effort in finding the problem and highlighting the fix. 32 34 33 35 ## 2.1.1 ## 34 35 ### Bug Fix ###36 36 37 37 * Replace hardcoded path to `admin-ajax.php` in widget administration javascript. … … 41 41 ## 2.1.0 ## 42 42 43 ### Bug Fixes ### 44 45 * Fix widget configuration autocomplete fields for target post and parent post in the theme customizer 46 * Fix taxonomy-term-filtered listings displaying all posts (e.g. shortcodes of the form `[a-z-listing taxonomy="category" terms="term"]) 47 * Fix `get_the_item_object()` to work with old-style overridden indices 48 * Fix `get_the_item_object()` to correctly extract the item ID and load the correct item 49 * Improve javascript on the widget configuration 50 * Clarified the examples with explanations about "post types", "taxonomies", and "terms" to explain what each of these mean. 51 52 ### New Features ### 53 54 * Add parent-page attribute to the shortcode 43 * Add parent-page attribute to the short-code 55 44 * Add simpler and safer filter for overriding the index letter for an item 56 45 * Add simpler and safer filter for overriding the title for an item … … 58 47 * Allow exclude-terms to be used with display="posts" 59 48 * Moved template loading function outside of the `A_Z_Query` class to prevent accidental access to the plugin internal structure 49 * Fix widget configuration autocomplete fields for target post and parent post in the theme customizer 50 * Fix taxonomy-term-filtered listings displaying all posts (e.g. short-codes of the form `[a-z-listing taxonomy="category" terms="term"]) 51 * Fix `get_the_item_object()` to work with old-style overridden indices 52 * Fix `get_the_item_object()` to correctly extract the item ID and load the correct item 53 * Improve javascript on the widget configuration 54 * Clarified the examples with explanations about "post types", "taxonomies", and "terms" to explain what each of these mean. 60 55 61 56 ## 2.0.6 ## … … 87 82 88 83 * Improved widget configuration. 89 * New attribute added to the short code when `display="posts"`:84 * New attribute added to the short-code when `display="posts"`: 90 85 * `exclude-posts`: remove specific posts from the list 91 * New attributes added to the short code when `display="terms"`:86 * New attributes added to the short-code when `display="terms"`: 92 87 * `exclude-terms`: sets the terms to exclude from display 93 88 * `parent-term`: set the parent that all displayed terms must be organised under … … 96 91 * Introduce PHP classes for adding numbers and grouping to the alphabet. Allows unhooking from the filters to undo the changes, where previously you could not unhook these modifications once they'd been applied. 97 92 98 ### BREAKING CHANGES ###93 ### BREAKING CHANGES in 2.0.0+ ### 99 94 100 95 * Multi column example: … … 134 129 ## 1.8.0 ## 135 130 136 * Add extra short code attributes:131 * Add extra short-code attributes: 137 132 * `numbers`: appends or prepends numerals to the alphabet 138 133 * Default value: unset … … 144 139 * Any value other than a positive number or the value `numbers` will default to disabling all grouping functionality 145 140 * When set to a number higher than `1` the listing will group letters together into ranges 146 * For example, if you chose `3` then a latin alphabet will group together `A`, `B`, and `C` into `A-C`. Likewise for `D-F`, `G-I` and so-on141 * For example, if you chose `3` then a Latin alphabet will group together `A`, `B`, and `C` into `A-C`. Likewise for `D-F`, `G-I` and so-on 147 142 * When using this setting, if numbers are also shown via the `numbers="before"` or `numbers="after"` attribute then they will be shown as a single separate group `0-9` 148 143 * When set to the value `numbers` it will group numerals into a single group `0-9` … … 155 150 * Including more than one letter/symbol in each group will display posts starting with any of those under the same section 156 151 * The first letter/symbol in each group is used as the group's heading when displayed on your site 157 * Bugfix: Shortcode to display taxonomy terms wouldn't also display numbers groups. Hat-tip to @sotos for the report.152 * Bugfix: short-code to display taxonomy terms wouldn't also display numbers groups. Hat-tip to @sotos for the report. 158 153 159 154 ## 1.7.2 ## 160 155 161 * Bugfix: Previous release broke the short code156 * Bugfix: Previous release broke the short-code 162 157 163 158 ## 1.7.1 ## 164 159 165 160 * Add additional filters allowing for hyphens or underscores to be used when defining. The readme.txt incorrectly used then-unsupported names with hyphens in examples so now we support both. 166 * Add numbers="before" and numbers="after" in short code161 * Add numbers="before" and numbers="after" in short-code 167 162 168 163 ## 1.7.0 ## 169 164 170 * Add support for taxonomy term listings to the short code171 * Add support for filtering by taxonomy terms to the short code165 * Add support for taxonomy term listings to the short-code 166 * Add support for filtering by taxonomy terms to the short-code 172 167 173 168 ## 1.6.5 ## … … 209 204 ## 1.5.1 ## 210 205 211 * Fix multiple post-types support for short code212 * Update documentation to explain how to show multiple post-types with the short code206 * Fix multiple post-types support for short-code 207 * Update documentation to explain how to show multiple post-types with the short-code 213 208 214 209 ## 1.5.0 ## … … 225 220 * Add support for passing a WP_Post object instead of an ID to the widget function 226 221 * Fix widget config not saving post-type parameter 227 * Fix warning of incorrect usage of `has_short code()` function222 * Fix warning of incorrect usage of `has_short-code()` function 228 223 * Fix section-targeting to work as described 229 224 … … 253 248 254 249 * BREAKING CHANGE: Refactored several function names. If you have written your own template/loop you will need to adapt your code. See the readme's Theming section for details. 255 * Added `post-type` attribute into the short code to display for post-types other than pages.250 * Added `post-type` attribute into the short-code to display for post-types other than pages. 256 251 * Minor code cleanup. 257 252 … … 284 279 ## 0.5 ## 285 280 286 * Added new short code to display the index page.281 * Added new short-code to display the index page. 287 282 288 283 ## 0.4 ## -
a-z-listing/trunk/classes/class-a-z-listing.php
r2056348 r2092139 19 19 * The taxonomy 20 20 * 21 * @var string 21 * @var string|array 22 22 */ 23 23 private $taxonomy; … … 133 133 $query = wp_parse_args( $query, $defaults ); 134 134 } elseif ( is_string( $query ) ) { 135 $taxonomies = explode( ',', $query ); 136 $taxonomies = array_unique( array_filter( array_map( 'trim', $taxonomies ) ) ); 137 135 138 $query = wp_parse_args( 136 139 array( 137 'taxonomy' => $query,140 'taxonomy' => (array) $taxonomies, 138 141 ), 139 142 $defaults … … 161 164 $query = apply_filters( 'a-z-listing-query', $query, 'terms' ); 162 165 166 if ( is_object( $query ) ) { 167 $query = (array) $query; 168 } 163 169 $this->taxonomy = $query['taxonomy']; 164 170 … … 188 194 * 189 195 * @since 1.0.0 196 * @since 2.0.0 apply to taxonomy queries. Add type parameter indicating type of query. 190 197 * @param array|Object|WP_Query $query The query object 191 198 */ … … 196 203 * 197 204 * @since 1.7.1 205 * @since 2.0.0 apply to taxonomy queries. Add type parameter indicating type of query. 198 206 * @param array|Object|WP_Query $query The query object 199 207 */ … … 458 466 if ( $section_object === $page ) { 459 467 $section_object = null; 460 } 461 462 if ( null !== $section_object ) { 468 } elseif ( null !== $section_object ) { 463 469 if ( isset( $section_object->post_name ) ) { 464 470 $section_name = $section_object->post_name; … … 664 670 global $post; 665 671 if ( 'terms' === $this->type ) { 666 $section = $this->taxonomy; 672 if ( is_array( $this->taxonomy ) ) { 673 $section = join( '_', $this->taxonomy ); 674 } else { 675 $section = $this->taxonomy; 676 } 667 677 } else { 668 678 $section = self::get_section(); -
a-z-listing/trunk/functions/helpers.php
r2056348 r2092139 335 335 */ 336 336 function a_z_listing_is_truthy( $value ) { 337 switch ( $value ) {338 case '1':339 case 'on':340 case 'yes':341 case 'true':342 case 1:343 case true:344 return true;345 default:346 return false;337 if ( '1' === $value || 338 'on' === $value || 339 'yes' === $value || 340 'true' === $value || 341 1 === $value || 342 true === $value 343 ) { 344 return true; 345 } else { 346 return false; 347 347 } 348 348 } -
a-z-listing/trunk/functions/shortcode.php
r2056348 r2092139 74 74 75 75 if ( 'terms' === $attributes['display'] && ! empty( $attributes['taxonomy'] ) ) { 76 $taxonomy = '' !== $attributes['taxonomy'] ? $attributes['taxonomy'] : 'category'; 77 $query = array( 78 'taxonomy' => $taxonomy, 79 'hide_empty' => isset( $attributes['hide_empty'] ) && a_z_listing_is_truthy( $attributes['hide-empty'] ), 76 $taxonomy = ! empty( $attributes['taxonomy'] ) ? $attributes['taxonomy'] : 'category'; 77 if ( isset( $attributes['hide-empty'] ) && ! empty( $attributes['hide-empty'] ) ) { 78 $hide_empty = a_z_listing_is_truthy( $attributes['hide-empty'] ); 79 } else { 80 $hide_empty = a_z_listing_is_truthy( $attributes['hide-empty-terms'] ); 81 } 82 83 $taxonomies = explode( ',', $taxonomy ); 84 $taxonomies = array_unique( array_filter( array_map( 'trim', $taxonomies ) ) ); 85 86 $query = array( 87 'taxonomy' => $taxonomies, 88 'hide_empty' => $hide_empty, 80 89 ); 81 90 … … 92 101 if ( ! empty( $terms_string ) ) { 93 102 $terms = explode( ',', $terms_string ); 94 $terms = array_map( 'trim', $terms ); 95 $terms = array_map( 'intval', $terms ); 96 $terms = array_filter( 97 $terms, 98 function( $value ) { 99 return 0 < $value; 100 } 101 ); 102 $terms = array_unique( $terms ); 103 $terms = array_unique( 104 array_filter( 105 array_map( 106 'intval', 107 array_map( 'trim', $terms ) 108 ), 109 function( $value ) { 110 return 0 < $value; 111 } 112 ) 113 ); 103 114 104 115 $query = wp_parse_args( … … 128 139 } 129 140 130 if ( ! empty( $attributes['hide-empty-terms'] ) ) {131 $hide_empty = a_z_listing_is_truthy( $attributes['hide-empty-terms'] );132 133 $query = wp_parse_args(134 $query,135 array(136 'hide_empty' => $hide_empty,137 )138 );139 }140 141 141 $a_z_query = new A_Z_Listing( $query, 'terms' ); 142 142 } else { 143 143 $post_type = explode( ',', $attributes['post-type'] ); 144 $post_type = array_ map( 'trim', $post_type);144 $post_type = array_unique( array_filter( array_map( 'trim', $post_type ) ) ); 145 145 146 146 $query = array( … … 150 150 if ( ! empty( $attributes['exclude-posts'] ) ) { 151 151 $exclude_posts = explode( ',', $attributes['exclude-posts'] ); 152 $exclude_posts = array_map( 'trim', $exclude_posts ); 153 $exclude_posts = array_map( 'intval', $exclude_posts ); 154 $exclude_posts = array_filter( 155 $exclude_posts, 156 function( $value ) { 157 return 0 < $value; 158 } 159 ); 160 $exclude_posts = array_unique( $exclude_posts ); 152 $exclude_posts = array_unique( 153 array_filter( 154 array_map( 155 'intval', 156 array_map( 'trim', $exclude_posts ) 157 ), 158 function( $value ) { 159 return 0 < $value; 160 } 161 ) 162 ); 161 163 162 164 if ( ! empty( $exclude_posts ) ) { … … 174 176 } 175 177 176 $taxonomy = '' !==$attributes['taxonomy'] ? $attributes['taxonomy'] : 'category';178 $taxonomy = $attributes['taxonomy'] ? $attributes['taxonomy'] : 'category'; 177 179 $tax_query = array(); 178 180 if ( ! empty( $attributes['terms'] ) ) { 179 181 $terms = explode( ',', $attributes['terms'] ); 180 $terms = array_map( 'trim', $terms ); 181 $terms = array_filter( 182 $terms, 183 function( $value ) { 184 return ! empty( $value ); 185 } 186 ); 187 $terms = array_unique( $terms ); 182 $terms = array_unique( array_filter( array_map( 'trim', $terms ) ) ); 188 183 189 184 $tax_query[] = array( … … 196 191 if ( ! empty( $attributes['exclude-terms'] ) ) { 197 192 $ex_terms = explode( ',', $attributes['exclude-terms'] ); 198 $ex_terms = array_map( 'trim', $ex_terms ); 199 $ex_terms = array_filter( 200 $ex_terms, 201 function( $value ) { 202 return ! empty( $value ); 203 } 204 ); 205 $ex_terms = array_unique( $ex_terms ); 193 $ex_terms = array_unique( array_filter( array_map( 'trim', $ex_terms ) ) ); 206 194 207 195 $tax_query[] = array( -
a-z-listing/trunk/languages/a-z-listing.pot
r2056348 r2092139 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: A-Z Listing 2. 2.0\n"5 "Project-Id-Version: A-Z Listing 2.3.0\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/a-z-listing\n" 7 "POT-Creation-Date: 2019-0 3-13 10:21:53+00:00\n"7 "POT-Creation-Date: 2019-05-20 22:04:04+00:00\n" 8 8 "MIME-Version: 1.0\n" 9 9 "Content-Type: text/plain; charset=utf-8\n" … … 25 25 "X-Generator: grunt-wp-i18n 1.0.3\n" 26 26 27 #: classes/class-a-z-listing.php:33 027 #: classes/class-a-z-listing.php:338 28 28 #. translators: List the aphabet of your language in the order that your 29 29 #. language prefers. list as groups of identical meanings but different … … 43 43 msgstr "" 44 44 45 #: classes/class-a-z-listing.php:3 3245 #: classes/class-a-z-listing.php:340 46 46 #. translators: This should be a single character to denote "all entries that 47 47 #. didn't fit under one of the alphabet character groups defined". This is used … … 50 50 #. letter. 51 51 msgid "#" 52 msgstr "" 53 54 #: functions/health-check.php:17 55 msgid "A to Z Listing plugin" 56 msgstr "" 57 58 #: functions/health-check.php:32 59 msgid "PHP mbstring module is enabled" 60 msgstr "" 61 62 #: functions/health-check.php:35 63 msgid "mbstring" 64 msgstr "" 65 66 #: functions/health-check.php:40 67 msgid "The mbstring PHP module improves support for non-latin languages." 68 msgstr "" 69 70 #: functions/health-check.php:48 71 msgid "PHP mbstring module is not enabled" 72 msgstr "" 73 74 #: functions/health-check.php:52 75 msgid "" 76 "The mbstring PHP module is not enabled on your server. This module improves " 77 "support for non-latin languages." 78 msgstr "" 79 80 #: functions/health-check.php:54 81 msgid "" 82 "Contact your web host to request that the mbstring PHP module is enabled " 83 "for your site." 52 84 msgstr "" 53 85 -
a-z-listing/trunk/readme.txt
r2056348 r2092139 6 6 Requires at least: 4.6 7 7 Requires PHP: 5.6 8 Tested up to: 5. 19 Stable tag: 2. 2.08 Tested up to: 5.2 9 Stable tag: 2.3.0 10 10 License: GPLv2 or later 11 11 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 20 20 Show your posts, pages, and terms alphabetically in a Rolodex-, catalogue-, or directory-style list with the A-Z Listing plugin! 21 21 22 The plugin has a short code for the list, and a widget so you can link to the list from anywhere on your site. If a letter doesn't have any pages then the widget will display the letter unlinked. The list page will omit the display for that letter entirely.22 The plugin has a short-code for the list, and a widget so you can link to the list from anywhere on your site. If a letter doesn't have any pages then the widget will display the letter unlinked. The list page will omit the display for that letter entirely. 23 23 24 24 Show posts from any or multiple post types including the in-built posts and pages. Also supported are post-types from plugins like WooCommerce products. Alternatively, show terms like categories or tags. … … 35 35 = Instructions = 36 36 37 1. Upload the `a-z-listing` folder to the `/wp-content/plugins/` directory38 1. Activate the plugin through the 'Plugins' menu in WordPress 39 1. Place `<?php the_a_z_listing(); ?>` in your templates for the index page output (see the **php** section of this document for details) or use the `a-z-listing` shortcode (see the **shortcode** section of this document for details).40 1. Add the A-Z Site Map widget to a sidebar or use `<?php the_a_z_widget( null, array( 'post' => get_page( $id ) ) ); ?>` in your templates (see the **php** section of this document for details).41 42 == Shortcode ==43 44 The plugin supplies a short code for the full A-Z listing allowing use without modifying your theme's templates.37 1. Upload the a-z-listing folder to the `/wp-content/plugins/` directory. 38 1. Activate the plugin through the 'Plugins' menu in WordPress. 39 1. Use the `[a-z-listing]` short-code on the page or post that you want to show the listing. 40 1. Add the A-Z Site Map widget to a sidebar. 41 42 == short-code == 43 44 The plugin supplies a short-code for the full A-Z listing allowing use without modifying your theme's templates. 45 45 46 46 Basic usage is as follows: … … 48 48 [a-z-listing] 49 49 50 To specify a post-type to display instead of `page` then use, e.g. ` Posts`:51 52 [a-z-listing post-type="post"]50 To specify a post-type to display instead of `page` then use, e.g. `post`: 51 52 [a-z-listing display="posts" post-type="post"] 53 53 54 54 To filter the posts by a term from a taxonomy: 55 55 56 [a-z-listing taxonomy="category" terms="my-term-slug"] 56 [a-z-listing display="posts" taxonomy="category" terms="my-term-slug"] 57 58 To display pages that are direct children of the page with ID `24`: 59 60 [a-z-listing display="posts" post-type="page" parent-post="24"] 61 62 To display pages that are children of any depth below the page with ID `24`: 63 64 [a-z-listing display="posts" post-type="page" parent-post="24" get-all-children="yes"] 57 65 58 66 To show terms from a taxonomy instead of posts and pages, e.g. Terms from the `Categories` taxonomy: 59 67 60 [a-z-listing taxonomy="category" display="terms"] 68 [a-z-listing display="terms" taxonomy="category"] 69 70 To show terms from the `Categories` taxonomy that are direct children of the term with ID of `42`: 71 72 [a-z-listing display="terms" taxonomy="category" parent-term="42"] 73 74 To show terms from the `Categories` taxonomy that are children of any depth in the tree below the term with ID of `42`: 75 76 [a-z-listing display="terms" taxonomy="category" parent-term="42" get-all-children="yes"] 61 77 62 78 To override the alphabet used by the plugin: 63 79 64 [a-z-listing alphabet="Aa,Bb,Cc,Dd,Ee,Ff,Gg,Hh,Ii,Jj,Kk,Ll,Mm,Nn,Oo,Pp,Qq,Rr,Ss,Tt,Uu,Vv,Ww,Xx,Yy,Zz"]80 [a-z-listing display="posts" alphabet="Aa,Bb,Cc,Dd,Ee,Ff,Gg,Hh,Ii,Jj,Kk,Ll,Mm,Nn,Oo,Pp,Qq,Rr,Ss,Tt,Uu,Vv,Ww,Xx,Yy,Zz"] 65 81 66 82 To add numbers to the listing: 67 83 68 [a-z-listing numbers="after"]84 [a-z-listing display="posts" numbers="after"] 69 85 70 86 The numbers can also be shown before the alphabet: 71 87 72 [a-z-listing numbers="before"]88 [a-z-listing display="posts" numbers="before"] 73 89 74 90 You can group the numbers into a single collection for all posts beginning with a numeral: 75 91 76 [a-z-listing numbers="after" group ing="numbers"]92 [a-z-listing numbers="after" group-numbers="yes"] 77 93 78 94 To group the alphabet letters into a range: … … 82 98 ** The arguments are all optional ** 83 99 84 * `display`: specifies whether to display posts or terms from a taxonomy 85 * Default value: `posts` 86 * May be set to either `posts` or `terms` 87 * Any value other than unset, `posts` or `terms` will default to displaying posts 88 * `post-type`: sets the listing to show a specific post-type 89 * Default value: `page` 90 * You may specify multiple post-types by separating with commas (`,`) e.g. `post-type="page,post"` 91 * `exclude-posts`: remove specific posts from the list 92 * Default value: unset 93 * Uses the `ID` of the post(s) 94 * Multiple posts may be specified by separating by commas: `,` 95 * Only affects `display="posts"` 96 * `taxonomy`: does nothing by itself, see the combinations below 97 * Default value: unset 98 * Uses the `slug` of the taxonomy 99 * When combined with: 100 * `terms=""`, will filter your posts by the terms you set there, which appear in the taxonomy set here 101 * `display="terms"`, will switch from displaying post titles to displaying the names of terms from the taxonomy specified 102 * `terms`: sets the taxonomy terms for filtering posts 103 * Default value: unset 104 * The taxonomy must also be specified in `taxonomy` 105 * Uses the `slug` of the term(s) when `display="posts"` and the `ID` of the term(s) when `display="terms"` 106 * Multiple terms may be specified by separating with commas: `,` 107 * May not be used with `exclude-terms=""` 108 * `exclude-terms`: sets the terms to exclude from display 109 * Default value: unset 110 * The taxonomy must also be specified in `taxonomy` 111 * Uses the `ID` of the term(s) 112 * Multiple terms may be specified by separating with commas: `,` 113 * May not be used with `terms=""` 114 * Only affects `display="terms"` 115 * `parent-term`: set the parent that all displayed terms must be organised under 116 * Default value: unset 117 * Uses the `slug` of the parent term 118 * Single value only 119 * Only affects `display="terms"` 120 * `hide-empty-terms`: hide terms that have no posts associated 121 * Default value: `false` 122 * May be set to `true` or `1` to hide the empty terms 123 * Only affects `display="terms"` 124 * `numbers`: appends or prepends numerals to the alphabet 125 * Default value: unset 126 * May be set to either `before` or `after` 127 * Any value other than unset, `before` or `after` will default to **appending** numerals to the alphabet 128 * `grouping`: tells the plugin if and how to group the alphabet 129 * Default value: unset 130 * May be set to any positive number greater than `1` or the value `numbers` 131 * Any value other than a positive number or the value `numbers` will default to disabling all grouping functionality 132 * When set to a number higher than `1` the listing will group letters together into ranges 133 * For example, if you chose `3` then a latin alphabet will group together `A`, `B`, and `C` into `A-C`. Likewise for `D-F`, `G-I` and so-on 134 * When using this setting, if numbers are also shown via the `numbers="before"` or `numbers="after"` attribute then they will be shown as a single separate group `0-9` 135 * When set to the value `numbers` it will group numerals into a single group `0-9` 136 * This requires the numbers to be displayed via the `numbers="before"` or `numbers="after"` attributes 137 * `alphabet`: allows you to override the alphabet that the plugin uses 138 * Default value: unset 139 * When this attribute is unset, the plugin will either use the untranslated default, or if [glotpress](https://translate.wordpress.org/projects/wp-plugins/a-z-listing) includes a translation for your site's language as set in `Admin -> Settings -> Site Language` it will use that translation 140 * The current untranslated default is: `AÁÀÄÂaáàäâ,Bb,Cc,Dd,EÉÈËÊeéèëê,Ff,Gg,Hh,IÍÌÏÎiíìïî,Jj,Kk,Ll,Mm,Nn,OÓÒÖÔoóòöô,Pp,Qq,Rr,Ssß,Tt,UÚÙÜÛuúùüû,Vv,Ww,Xx,Yy,Zz` 141 * Accepts a single line of letters/symbols, which need to be separated via the comma character `,` 142 * Including more than one letter/symbol in each group will display posts starting with any of those under the same section 143 * The first letter/symbol in each group is used as the group's heading when displayed on your site 100 = Common options = 101 102 * `display`: specifies whether to display posts or terms from a taxonomy. 103 * Default value: `posts`. 104 * May only contain one value. 105 * Must be set to either `posts` or `terms`. 106 * Any value other than `posts` or `terms` will default to displaying posts. 107 * `numbers`: appends or prepends numerals to the alphabet. 108 * Default value: `unset`. 109 * May only contain one value. 110 * Must be set to either `before` or `after`. 111 * Any value other than `before` or `after` will default to **appending** numerals to the alphabet. 112 * `grouping`: tells the plugin if and how to group the alphabet. 113 * Default value: `unset`. 114 * May only contain one value. 115 * Must be set to any positive number greater than `1` or the value `numbers`. 116 * Any value other than a positive number or the value `numbers` will default to disabling all grouping functionality. 117 * When set to a number higher than `1` the listing will group letters together into ranges. 118 * For example, if you chose `3` then a Latin alphabet will group together `A`, `B`, and `C` into `A-C`. Likewise for `D-F`, `G-I` and so-on. 119 * When using this setting, if numbers are also shown via the `numbers="before"` or `numbers="after"` attribute then they will be shown as a single separate group `0-9`. 120 * When set to the value `numbers` it will group numerals into a single group `0-9`. 121 * This requires the numbers to be displayed via the `numbers="before"` or `numbers="after"` attributes. 122 * `group-numbers`: tells the plugin to group all items beginning with a numeral into a single collection. 123 * Default value: `false`. 124 * May only contain one value. 125 * Must be set to `true`, `yes`, `on`, or `1` to group items beginning with a numeral in a single collection. All other values will keep the default behaviour. 126 * `alphabet`: allows you to override the alphabet that the plugin uses. 127 * Default value: `unset`. 128 * When this attribute is not defined, the plugin will either use the untranslated default, or if [glotpress](https://translate.wordpress.org/projects/wp-plugins/a-z-listing) includes a translation for your site's language as set in `Admin -> Settings -> Site Language` it will use that translation. 129 * The current untranslated default is: `AÁÀÄÂaáàäâ,Bb,Cc,Dd,EÉÈËÊeéèëê,Ff,Gg,Hh,IÍÌÏÎiíìïî,Jj,Kk,Ll,Mm,Nn,OÓÒÖÔoóòöô,Pp,Qq,Rr,Ssß,Tt,UÚÙÜÛuúùüû,Vv,Ww,Xx,Yy,Zz`. 130 * Accepts a single line of letters/symbols, which need to be separated via the comma character `,`. 131 * Including more than one letter/symbol in each group will display posts starting with any of those under the same section. 132 * The first letter/symbol in each group is used as the group's heading when displayed on your site. 133 134 = Posts options = 135 136 * `post-type`: sets the listing to show a specific post-type. 137 * Default value: `page`. 138 * Multiple post-types may be specified by separating with commas (`,`) e.g. `post-type="page,post"`. 139 * Must be the `slug` of the post-type(s). 140 * `parent-post`: sets the parent post that all displayed posts must be descended from. 141 * Default value: `unset`. 142 * May only contain one value. 143 * Must be the `ID` of the parent post. 144 * Add `get-all-children="yes"` to also include all descendants of any depth below the parent post. 145 * `exclude-posts`: remove these posts from the list. 146 * Default value: `unset`. 147 * Multiple posts may be specified by separating by commas: `,`. 148 * Must be the `ID` of the post(s). 149 * `taxonomy`: sets the taxonomy containing the terms specified in the `terms=""` option. 150 * Default value: `unset`. 151 * May only contain one value. 152 * Must be the `slug` of the taxonomy. 153 * `terms`: sets the taxonomy terms for filtering posts. 154 * Default value: `unset`. 155 * The taxonomy must also be specified in `taxonomy`. 156 * Multiple terms may be specified by separating with commas: `,`. 157 * Must be the `slug` of the term(s). 158 159 = Terms options = 160 161 * `taxonomy`: sets the taxonomy to display terms from in the listing. 162 * Default value: `unset`. 163 * Multiple taxonomies may be specified by separating with commas: `,`. 164 * Must be the `slug` of the taxonomy. 165 * `terms`: sets the taxonomy terms to include in the listing. 166 * Default value: `unset`. 167 * The taxonomy must also be specified in `taxonomy`. 168 * Multiple terms may be specified by separating with commas: `,`. 169 * Must be the `ID` of the term(s). 170 * Cannot be used with `exclude-terms=""`. 171 * `exclude-terms`: sets the terms to exclude from display. 172 * Default value: `unset`. 173 * The taxonomy must also be specified in `taxonomy`. 174 * Multiple terms may be specified by separating with commas: `,`. 175 * Must be the `ID` of the term(s). 176 * Cannot be used with `terms=""`. 177 * `parent-term`: set the parent that all displayed terms must be descended from. 178 * Default value: `unset`. 179 * May only contain one value. 180 * Must be the `slug` of the parent term. 181 * Add `get-all-children="yes"` to also include all descendants of any depth below the parent term. 182 * `get-all-children`: when a parent term is chosen this option is used to show all children of any depth or only direct children. 183 * Default value: `false`. 184 * May only contain one value. 185 * Must be set to `true`, `yes`, `on`, or `1` to include all children of any depth. Any value other will use the default behaviour of only showing direct children. 186 * `hide-empty-terms`: hide terms that have no posts associated. 187 * Default value: `false`. 188 * May only contain one value. 189 * Must be set to `true`, `yes`, `on`, or `1` to hide the empty terms. Any other value will use the default behaviour of showing all terms. 190 191 = Internal-use options for completeness = 192 193 ** You should not need to touch these, as they are meant for internal use by the plugin only** 194 195 * `target`: the default target for a listing that doesn't show any items. 196 * Default value: `unset`. 197 * May only contain one value. 198 * Must be set to a URL which will be used as the target for the letters' hyperlinks. 199 * `return`: what type of listing to show, either `listing` or `letters`. 200 * Default value: `listing`. 201 * May only contain one value. 202 * Must be set to either `listing` to display the default view, or `letters` to show only the letters without any items (posts or terms). 144 203 145 204 == PHP == … … 165 224 Full API documentation is available at [A-Z-Listing Reference](https://a-z-listing.com/reference/) 166 225 167 == Multi Column Output ==168 169 If you want the multi-column output support, you need to copy the file `a-z-listing-multi-column.example.php` from the plugin inside the `templates` directory to your theme. The file needs to also be renamed to `a-z-listing.php` when copied to your theme. The **Templates and Theming** section of this Document details the functions used within templates and The Loop process this plugin follows.226 == Multiple Column Output == 227 228 Multiple column layout is the default on wide screens. A letter's group of items must contain at least 15 items to create two or more columns. This is to provide a more aesthetically pleasing view when a list is short with only a few items. 170 229 171 230 == Templates and Theming == … … 185 244 * `$a_z_query->the_letters()` prints the full alphabet, and links the letters that have posts to their section within the index page. 186 245 * `$a_z_query->have_letters()` returns true or false depending on whether there are any letters left to loop-through. This is part of the Letter Loop. 187 * `$a_z_query->have_items()` thisbehaves very similarly to Core's `have_posts()` function. It is part of the Item Loop.246 * `$a_z_query->have_items()` behaves very similarly to Core's `have_posts()` function. It is part of the Item Loop. 188 247 * `$a_z_query->the_letter()` similar to Core's `the_post()`, this will set-up the next iteration of the A-Z Listing's Letter Loop. This needs to wrap-around the Item Loop. 189 248 * `$a_z_query->the_item()` similar to Core's `the_post()`, this will set-up the next iteration of the A-Z Listing's Item Loop, the same way the normal WordPress Loop works. This needs to be _within_ the Letter Loop. … … 191 250 When you are within the Item Loop you may utilise all in-built WordPress Core post-related functions such as `the_content()`. Note that titles and permalinks have helper functions to cope with the A-Z Listing showing taxonomy terms (see the next section). 192 251 193 I advise that you start with a copy of the default template or the multi-columntemplate when customizing your own version. The supplied templates show the usage of most of the functions this plugin provides.252 I advise that you start with a copy of the default template template when customizing your own version. The supplied templates show the usage of most of the functions this plugin provides. 194 253 195 254 = Helper functions = … … 210 269 = Why is the list layout completely broken? = 211 270 212 If you are using a page-builder such as WPBakery or Elementor you need to ensure that you put the short code into a normal text area. Placing the shortcode into a preformatted text area will add `<pre>` tags around the listing output. These extra tags break the layout considerably.271 If you are using a page-builder such as WPBakery or Elementor you need to ensure that you put the short-code into a normal text area. Placing the short-code into a preformatted text area will add `<pre>` tags around the listing output. These extra tags break the layout considerably. 213 272 214 273 = Why is my list in a single column? = 215 274 216 The list of items under each letter heading needs to have at least 11 items for a second column to be created. Once you hit the magic 11 items, the list will break into two columns with 6 items in the first column and 5 items in the second. When you get to 21 items a third column will be added if there is room on your page; and so-on up to a maximum of 15 columns if there is enough space, though it is unexpected that any web page be wide enough for more than a few columns to fit. The columns will fill-up evenly once you have more than one column on the page.217 218 = How do I show posts of a different post-type (not pages) or multiple post-types (e.g. posts AND pages) =219 220 This can be achieved using the short code or PHP. In these examples the generic phrase `post-type-slug` is used to describe the concept. The default post types provided by WordPress are called "Posts" and "Pages". Their slugs are `post` and `page` respectively. You need to use these names in place of the examples (i.e. `your-post-type-slug`, `type1-slug`, and `type1-slug`).221 222 ** Shortcode method**275 The list of items under each letter heading needs to have at least 11 items for a second column to be created. Once you hit the magic 11 items, the list will break into two columns with 6 items in the first column and 5 items in the second. When you get to 21 items a third column will be added if there is room on your page; and so-on up to a maximum of 15 columns if there is enough space, though it is unexpected that any web-page be wide enough for more than a few columns to fit. The columns will fill-up evenly once you have more than one column on the page. 276 277 = How do I show posts of a different post-type (not pages) or multiple post-types (e.g. posts AND pages)? = 278 279 This can be achieved using the short-code or PHP. In these examples the generic phrase `post-type-slug` is used to describe the concept. The default post types provided by WordPress are called "Posts" and "Pages". Their slugs are `post` and `page` respectively. You need to use these names in place of the examples (i.e. `your-post-type-slug`, `type1-slug`, and `type1-slug`). 280 281 **short-code method** 223 282 224 283 *Single post-type* … … 234 293 **PHP method** 235 294 236 PHP code needs to be added to your theme files, and cannot be used as post or page content in the way that a short code can.295 PHP code needs to be added to your theme files, and cannot be used as post or page content in the way that a short-code can. 237 296 238 297 *Single post-type* … … 260 319 The code above needs to be within a php block which is denoted by the `<?php` and `?>` pair. Depending on your theme, you might not need the opening and closing php tags shown in the above snippet; if that is the case, you are free to omit them in your code. 261 320 262 = How do I show posts from a specific category only =263 264 This can be achieved using the short code or PHP. In these examples the generic phrase `taxonomy` and `term` are used to describe the concept. The default taxonomies provided by WordPress are called "Categories" and "Tags". Their slugs are `category` and `post_tag` respectively. Each Category and Tag are then known as "terms". You need to use the slug for each individual category or tag in place of the example slugs (i.e. `term-slug`, `term1-slug`, and `term1-slug`).265 266 ** Shortcode method**321 = How do I show posts from a specific category only? = 322 323 This can be achieved using the short-code or PHP. In these examples the generic phrase `taxonomy` and `term` are used to describe the concept. The default taxonomies provided by WordPress are called "Categories" and "Tags". Their slugs are `category` and `post_tag` respectively. Each Category and Tag are then known as "terms". You need to use the slug for each individual category or tag in place of the example slugs (i.e. `term-slug`, `term1-slug`, and `term1-slug`). 324 325 **short-code method** 267 326 268 327 *Single term* … … 278 337 **PHP method** 279 338 280 PHP code needs to be added to your theme files, and cannot be used as post or page content in the way that a short code can.339 PHP code needs to be added to your theme files, and cannot be used as post or page content in the way that a short-code can. 281 340 282 341 ` … … 298 357 The code above needs to be within a php block which is denoted by the `<?php` and `?>` pair. Depending on your theme, you might not need the opening and closing php tags shown in the above snippet; if that is the case, you are free to omit them in your code. 299 358 300 = How do I show terms from a taxonomy instead of posts =301 302 This can be achieved using the short code or PHP. In these examples the generic phrase `taxonomy` and `term` are used to describe the concept. The default taxonomies provided by WordPress are called "Categories" and "Tags". Their slugs are `category` and `post_tag` respectively. You need to use the slug for the taxonomy in place of the example slugs (i.e. `taxonomy-slug`).303 304 ** Shortcode method**359 = How do I show terms from a taxonomy instead of posts? = 360 361 This can be achieved using the short-code or PHP. In these examples the generic phrase `taxonomy` and `term` are used to describe the concept. The default taxonomies provided by WordPress are called "Categories" and "Tags". Their slugs are `category` and `post_tag` respectively. You need to use the slug for the taxonomy in place of the example slugs (i.e. `taxonomy-slug`). 362 363 **short-code method** 305 364 306 365 [a-z-listing taxonomy="taxonomy-slug" display="terms"] … … 312 371 **PHP method** 313 372 314 PHP code needs to be added to your theme files, and cannot be used as post or page content in the way that a short code can.373 PHP code needs to be added to your theme files, and cannot be used as post or page content in the way that a short-code can. 315 374 316 375 ` … … 326 385 = How do I remove section targeting or limit which sections are available? = 327 386 328 In your theme's functions.phpadd the following code:387 In your theme's `functions.php` file add the following code: 329 388 330 389 ` … … 340 399 = I am not using the short-code so the styles are not working, can I still use the in-built styles without the short-code? = 341 400 342 Yes you can. This needs the following code added to your theme's functions.php. We purposely only display the stylesheet on pages where the short-code is active.401 Yes you can. This needs the following code added to your theme's `functions.php` file. We purposely only display the stylesheet on pages where the short-code is active. 343 402 344 403 ` … … 348 407 ` 349 408 350 If there is code already in your functions.phpthen add just the lines between `<?php` and `?>` on the line directly after the very first instance of `<?php`.409 If there is code already in your theme's `functions.php` file then add just the lines between `<?php` and `?>` on the line directly after the very first instance of `<?php`. 351 410 352 411 The sidebar widget styling also works in a similar manner, and will also respond to the same code above to forcibly enable it. … … 366 425 ` 367 426 368 If there is code already in your functions.phpthen add just the lines between `<?php` and `?>` on the line directly after the very first instance of `<?php`.427 If there is code already in your theme's `functions.php` file then add just the lines between `<?php` and `?>` on the line directly after the very first instance of `<?php`. 369 428 370 429 = How do I disable the in-built styling? = … … 399 458 == Changelog == 400 459 460 = 2.3.0 = 461 462 * Add multiple taxonomy support to taxonomy terms listing. 463 * Add site health-check feature compatibility. 464 * Fix `hide-empty-terms` in a taxonomy terms listing. Previously completely broken. 465 * Fix hard-coded `admin-ajax.php` URL in widget configuration javascript. 466 * Improve documentation in the readme.txt file, which is shown on the plugin page at WordPress.org. 467 401 468 = 2.2.0 = 402 469 403 470 * Add `get_the_item_post_count` and `the_item_post_count` template methods to get or display the number of posts associated with a term. 404 471 * Add support for `get-all-children` when specifying a `parent-term`. 405 * Add extra filename for template matching: `a-z-listing-$slug.php` where `$slug` is the slug of the post containing the short code.472 * Add extra filename for template matching: `a-z-listing-$slug.php` where `$slug` is the slug of the post containing the short-code. 406 473 * Deprecate PHP 5.3-5.5. Please ensure you are running at least PHP 5.6. The plugin may work on older PHP versions, but compatibility is not guaranteed. 407 * Bugfix for incorrect behaviour of `exclude-terms` in the shortcode. Thanks go to Chris Skrzypchak for finding this. 408 409 = 2.1.4 = 410 411 **Bug Fix** 412 413 * Fixed a spurious `NOTICE` message (shown below) when error logging is output to the browser. Thanks to the discovery by @npiper. 414 * If your site is not showing the message below then you do not need to upgrade with any urgency. 415 416 `Notice: Trying to get property of non-object in [Path-to-WordPress]/wp-content/plugins/a-z-listing/classes/class-a-z-listing.php on line 215` 417 418 = 2.1.3 = 419 420 **Bug Fix** 421 422 * Fixed the bug reported by @ighosts22 where the letter for non-alphabetic items was not pointing at the list of items. 423 * Fixed incorrect behaviour discovered after adding tests to the automated testing to verify that I correctly fixed the above bug. 424 425 = 2.1.2 = 426 427 **Bug Fix** 428 429 * Post links in 2.1.0 and 2.1.1 included a series of `%09` which caused visitors' clicks to return a 404 Not Found error. Thanks to @forestpump for their effort in finding the problem and highlighting the fix. 430 431 = 2.1.1 = 432 433 **Bug Fix** 434 435 * Replace hardcoded path to `admin-ajax.php` in widget administration javascript. 436 * This release fixes the widget administration form for sites running in a path similar to https://example.com/wp/. You should install this fix if your site is a configured in a subfolder to be able to successfully configure the widget. 437 * Sites running in the top-level, e.g. https://example.com/, already work correctly and their behaviour is unchanged by this fix. You do not need to hurry to update if your site is configured at the top-level without a subfolder. 438 439 = 2.1.0 = 440 441 **Bug Fixes** 442 443 * Fix widget configuration autocomplete fields for target post and parent post in the theme customizer 444 * Fix taxonomy-term-filtered listings displaying all posts (e.g. shortcodes of the form `[a-z-listing taxonomy="category" terms="term"]) 445 * Fix `get_the_item_object()` to work with old-style overridden indices 446 * Fix `get_the_item_object()` to correctly extract the item ID and load the correct item 447 * Improve javascript on the widget configuration 448 * Clarified the examples with explanations about "post types", "taxonomies", and "terms" to explain what each of these mean. 449 450 **New Features** 451 452 * Add parent-page attribute to the shortcode 453 * Add simpler and safer filter for overriding the index letter for an item 454 * Add simpler and safer filter for overriding the title for an item 455 * Add new function for fetching meta data in a template: `$a_z_listing->get_item_meta()` 456 * Allow exclude-terms to be used with display="posts" 457 * Moved template loading function outside of the `A_Z_Query` class to prevent accidental access to the plugin internal structure 458 459 = 2.0.6 = 460 461 * Fix widget target post support 462 * Fix filtering posts by multiple taxonomy terms 463 * Fix styling error causing two or more posts to sometimes appear on the same line 464 * Minor style tweak to fix short listings, and long titles 465 * Fix broken styling in 2.0.0 466 * Fix javascript error on widgets screen 467 468 = 2.0.0 = 469 470 * Improved widget configuration. 471 * New attribute added to the shortcode when `display="posts"`: 472 * `exclude-posts`: remove specific posts from the list 473 * New attributes added to the shortcode when `display="terms"`: 474 * `exclude-terms`: sets the terms to exclude from display 475 * `parent-term`: set the parent that all displayed terms must be organised under 476 * `hide-empty-terms`: hide terms that have no posts associated 477 * Fix the stylesheet to better cope with variances in font-size and text length in the alphabet links list and widget. 478 * Introduce PHP classes for adding numbers and grouping to the alphabet. Allows unhooking from the filters to undo the changes, where previously you could not unhook these modifications once they'd been applied. 479 480 **BREAKING CHANGES** 474 * Bugfix for incorrect behaviour of `exclude-terms` in the short-code. Thanks go to Chris Skrzypchak for finding this. 475 476 = BREAKING CHANGES in 2.0.0+ = 481 477 482 478 *Multi column example* -
a-z-listing/trunk/scripts/a-z-listing-tabs.js
r2003543 r2092139 3 3 const tabs = document.getElementById( 'az-tabs' ); 4 4 if ( tabs ) { 5 let link; 6 const letters = tabs.getElementById( 'letters' ); 7 if ( letters ) { 8 link = letters.querySelector( `a[href="${window.location.hash}"]` ); 9 } 5 const link = tabs.querySelector( `#letters a[href="${window.location.hash}"]` ); 10 6 11 7 if ( window.location.hash && link ) { -
a-z-listing/trunk/scripts/a-z-listing-widget-admin.js
r2004405 r2092139 56 56 source: function( post_title, response ) { 57 57 jQuery.ajax( { 58 url: a_z_listing_widget_admin.ajax_url || ' admin-ajax.php',58 url: a_z_listing_widget_admin.ajax_url || '/wp-admin/admin-ajax.php', 59 59 type: 'POST', 60 60 dataType: 'json', … … 85 85 source: function( post_title, response ) { 86 86 jQuery.ajax( { 87 url: '/wp-admin/admin-ajax.php',87 url: a_z_listing_widget_admin.ajax_url || '/wp-admin/admin-ajax.php', 88 88 type: 'POST', 89 89 dataType: 'json', -
a-z-listing/trunk/widgets/class-a-z-listing-widget.php
r2056348 r2092139 66 66 $widget_title_name = $this->get_field_name( 'title' ); 67 67 68 $display_type = ( 'terms' === $instance['type'] ) ? 'terms' : 'posts';68 $display_type = ( isset( $instance['type'] ) && 'terms' === $instance['type'] ) ? 'terms' : 'posts'; 69 69 $display_type_id = $this->get_field_id( 'type' ); 70 70 $display_type_name = $this->get_field_name( 'type' );
Note: See TracChangeset
for help on using the changeset viewer.