Add list type to shortcode and then some
This commit is contained in:
parent
b4a500dd09
commit
61bfbd49bc
@ -359,7 +359,6 @@ Fictioneer customizes WordPress by using as many standard action and filter hook
|
||||
| `pre_comment_user_ip` | `__return_empty_string`
|
||||
| `pre_get_posts` | `fictioneer_extend_taxonomy_pages`, `fictioneer_edit_others_fictioneer_posts`, `fictioneer_add_sof_to_taxonomy_query`
|
||||
| `pre_insert_term` | `fictioneer_restrict_tag_creation`
|
||||
| `pre_option_{$option}` | `fictioneer_override_autoptimize_optimize_logged_option`
|
||||
| `preprocess_comment` | `fictioneer_preprocess_comment`, `fictioneer_validate_comment_form`
|
||||
| `protected_title_format` | `fictioneer_remove_protected_text`
|
||||
| `query_vars` | `fictioneer_query_vars`
|
||||
|
@ -27,7 +27,7 @@ For simplicity, here is the copied content of the [demo homepage](https://fictio
|
||||
<!-- /wp:spacer -->
|
||||
|
||||
<!-- wp:shortcode -->
|
||||
[fictioneer_article_cards per_page="2" ignore_sticky="1"]
|
||||
[fictioneer_article_cards per_page="2" ignore_sticky="true"]
|
||||
<!-- /wp:shortcode -->
|
||||
|
||||
<!-- wp:heading -->
|
||||
@ -134,7 +134,7 @@ For simplicity, here is the copied content of the [demo homepage](https://fictio
|
||||
<!-- /wp:heading -->
|
||||
|
||||
<!-- wp:shortcode -->
|
||||
[fictioneer_latest_chapters count="2" post_ids="29,92" orderby="post__in" spoiler="true" vertical="1" seamless="1" aspect_ratio="4/1" type="simple" source="0" lightbox="0"]
|
||||
[fictioneer_latest_chapters count="2" post_ids="29,92" orderby="post__in" spoiler="true" vertical="true" seamless="true" aspect_ratio="4/1" type="simple" source="0" lightbox="0"]
|
||||
<!-- /wp:shortcode -->
|
||||
|
||||
<!-- wp:spacer {"height":"1rem"} -->
|
||||
@ -162,7 +162,7 @@ For simplicity, here is the copied content of the [demo homepage](https://fictio
|
||||
<!-- /wp:html -->
|
||||
|
||||
<!-- wp:shortcode -->
|
||||
[fictioneer_story_comments story_id="13" header="1"]
|
||||
[fictioneer_story_comments story_id="13" header="true"]
|
||||
<!-- /wp:shortcode -->
|
||||
```
|
||||
|
||||
@ -737,7 +737,7 @@ Renders the chapters, groups, and tabs of the specified story. It will look just
|
||||
```
|
||||
|
||||
```
|
||||
[fictioneer_story_section story_id="182" tabs="1" pages="1"]
|
||||
[fictioneer_story_section story_id="182" tabs="true" pages="true"]
|
||||
```
|
||||
|
||||
### Story Comments Shortcode
|
||||
@ -831,6 +831,8 @@ Renders a multi-column grid of paginated medium cards ordered by publishing date
|
||||
* **seamless:** Whether to remove the gap between the image and frame. Default `false` (Customizer setting).
|
||||
* **thumbnail:** Whether to show the thumbnail/cover image. Default `true` (Customizer setting).
|
||||
* **lightbox:** Whether clicking on the thumbnail/cover image opens the lightbox or post link. Default `true`.
|
||||
* **date_format:** String to override the [date format](https://wordpress.org/documentation/article/customize-date-and-time-format/). Default `''`.
|
||||
* **nested_date_format:** String to override any nested [date formats](https://wordpress.org/documentation/article/customize-date-and-time-format/). Default `''`.
|
||||
* **footer:** Whether to show the footer (if any). Default `true`.
|
||||
* **footer_author:** Whether to show the post author. Default `true`.
|
||||
* **footer_date:** Whether to show the post date. Default `true`.
|
||||
@ -843,15 +845,15 @@ Renders a multi-column grid of paginated medium cards ordered by publishing date
|
||||
```
|
||||
|
||||
```
|
||||
[fictioneer_article_cards post_type="post" per_page="4" ignore_sticky="1"]
|
||||
[fictioneer_article_cards post_type="post" per_page="4" ignore_sticky="true"]
|
||||
```
|
||||
|
||||
```
|
||||
[fictioneer_article_cards post_type="story, chapter" count="8" ignore_protected="1"]
|
||||
[fictioneer_article_cards post_type="story, chapter" count="8" ignore_protected="true"]
|
||||
```
|
||||
|
||||
```
|
||||
[fictioneer_article_cards post_type="story, chapter" seamless="1" aspect_ratio="4/1"]
|
||||
[fictioneer_article_cards post_type="story, chapter" seamless="true" aspect_ratio="4/1"]
|
||||
```
|
||||
|
||||

|
||||
@ -904,7 +906,7 @@ Renders a multi-column grid of small bookmark cards, ordered by date of creation
|
||||
```
|
||||
|
||||
```
|
||||
[fictioneer_bookmarks count="8" seamless="1" thumbnail="0"]
|
||||
[fictioneer_bookmarks count="8" seamless="true" thumbnail="0"]
|
||||
```
|
||||
|
||||

|
||||
@ -975,15 +977,15 @@ Renders two buttons to deal with cookies, "Reset Consent" and "Clear Cookies". B
|
||||
|
||||
### Latest Chapters
|
||||
|
||||
Renders a multi-column grid of small cards, showing the latest four chapters ordered by publishing date, descending.
|
||||
Renders a multi-column grid of small cards, showing the latest four chapters ordered by publishing date, descending. Note that the `list` type behaves a bit different with the parameters.
|
||||
|
||||
* **count:** Limit chapters to any positive number, although you should keep it reasonable. Default `4`.
|
||||
* **type:** Either `default`, `simple`, or `compact`. The other variants are smaller with less data.
|
||||
* **type:** Either `default`, `simple`, `compact`, or `list`. The other variants are smaller with less data.
|
||||
* **author:** Only show chapters of a specific author. Make sure to use the url-safe nice_name.
|
||||
* **order:** Either `desc` (descending) or `asc` (ascending). Default `desc`.
|
||||
* **orderby:** The default is `date`, but you can also use `modified` and [more](https://developer.wordpress.org/reference/classes/wp_query/#order-orderby-parameters).
|
||||
* **spoiler:** The excerpt is obfuscated, set `true` if you want to reveal it. Default `false`.
|
||||
* **source:** Set `false` to hide the author and story nodes. Default `true`.
|
||||
* **source:** Whether to show the author and story nodes. Default `true`.
|
||||
* **post_ids:** Comma-separated list of post IDs, if you want to pick from a curated pool.
|
||||
* **ignore_protected:** Whether protected posts should be ignored or not. Default `false`.
|
||||
* **author_ids:** Only show posts of a comma-separated list of author IDs.
|
||||
@ -1001,7 +1003,10 @@ Renders a multi-column grid of small cards, showing the latest four chapters ord
|
||||
* **thumbnail:** Whether to show the thumbnail/cover image. Default `true` (Customizer setting).
|
||||
* **lightbox:** Whether clicking on the thumbnail/cover image opens the lightbox or post link. Default `true`.
|
||||
* **infobox:** Whether to show the info box and toggle on compact versions. Default `true`.
|
||||
* **date_format:** String to override the [date format](https://wordpress.org/documentation/article/customize-date-and-time-format/). Default `''`.
|
||||
* **nested_date_format:** String to override any nested [date formats](https://wordpress.org/documentation/article/customize-date-and-time-format/). Default `''`.
|
||||
* **footer:** Whether to show the footer (if any). Default `true`.
|
||||
* **footer_author:** Whether to show the chapter author. Default `true`.
|
||||
* **footer_words:** Whether to show the chapter word count. Default `true`.
|
||||
* **footer_date:** Whether to show the chapter date. Default `true`.
|
||||
* **footer_comments:** Whether to show the chapter comment count. Default `true`.
|
||||
@ -1023,7 +1028,7 @@ Renders a multi-column grid of small cards, showing the latest four chapters ord
|
||||
```
|
||||
|
||||
```
|
||||
[fictioneer_latest_chapters source="false" vertical="1" seamless="1" aspect_ratio="5/1"]
|
||||
[fictioneer_latest_chapters source="false" vertical="true" seamless="true" aspect_ratio="5/1"]
|
||||
```
|
||||
|
||||

|
||||
@ -1102,7 +1107,7 @@ Renders a multi-column grid of small cards, showing the latest four recommendati
|
||||
```
|
||||
|
||||
```
|
||||
[fictioneer_latest_recommendations vertical="1" seamless="1"]
|
||||
[fictioneer_latest_recommendations vertical="true" seamless="true"]
|
||||
```
|
||||
|
||||

|
||||
@ -1110,10 +1115,10 @@ Renders a multi-column grid of small cards, showing the latest four recommendati
|
||||
|
||||
### Latest Stories
|
||||
|
||||
Renders a multi-column grid of small cards, showing the latest four stories ordered by publishing date, descending.
|
||||
Renders a multi-column grid of small cards, showing the latest four stories ordered by publishing date, descending. Note that the `list` type behaves a bit different with the parameters.
|
||||
|
||||
* **count:** Limit stories to any positive number, although you should keep it reasonable. Default `4`.
|
||||
* **type:** Either `default` or `compact`. The compact variant is smaller with less data.
|
||||
* **type:** Either `default`, `compact`, or `list`. The compact variant is smaller with less data.
|
||||
* **author:** Only show stories of a specific author. Make sure to spell the _username_ right.
|
||||
* **order:** Either `desc` (descending) or `asc` (ascending). Default `desc`.
|
||||
* **orderby:** The default is `date`, but you can also use `modified` and [more](https://developer.wordpress.org/reference/classes/wp_query/#order-orderby-parameters).
|
||||
@ -1129,13 +1134,17 @@ Renders a multi-column grid of small cards, showing the latest four stories orde
|
||||
* **genres:** Comma-separated list of genre names (case-insensitive), if you want to pick from a curated pool.
|
||||
* **characters:** Comma-separated list of character names (case-insensitive), if you want to pick from a curated pool.
|
||||
* **rel:** Relationship between different taxonomies, either `AND` or `OR`. Default `AND`.
|
||||
* **source:** Set `false` to hide the author node. Default `true`.
|
||||
* **source:** Whether to show the author node. Default `true`.
|
||||
* **vertical:** Whether to render the cards with the image on top. Default `false`.
|
||||
* **seamless:** Whether to remove the gap between the image and frame. Default `false` (Customizer setting).
|
||||
* **thumbnail:** Whether to show the thumbnail/cover image. Default `true` (Customizer setting).
|
||||
* **lightbox:** Whether clicking on the thumbnail/cover image opens the lightbox or post link. Default `true`.
|
||||
* **infobox:** Whether to show the info box and toggle on compact versions. Default `true`.
|
||||
* **date_format:** String to override the [date format](https://wordpress.org/documentation/article/customize-date-and-time-format/). Default `''`.
|
||||
* **terms:** Either `inline`, `pills`, or `none` (only in type `list`). Default `inline`.
|
||||
* **max_terms:** Maximum number of shown taxonomies (only in type `list`). Default `10`.
|
||||
* **footer:** Whether to show the footer (if any). Default `true`.
|
||||
* **footer_author:** Whether to show the author. Default `true`.
|
||||
* **footer_chapters:** Whether to show the chapter count. Default `true`.
|
||||
* **footer_words:** Whether to show the word count. Default `true`.
|
||||
* **footer_date:** Whether to show the date. Default `true`.
|
||||
@ -1157,11 +1166,11 @@ Renders a multi-column grid of small cards, showing the latest four stories orde
|
||||
```
|
||||
|
||||
```
|
||||
[fictioneer_latest_stories count="2" author="Hungry" seamless="1"]
|
||||
[fictioneer_latest_stories count="2" author="Hungry" seamless="true"]
|
||||
```
|
||||
|
||||
```
|
||||
[fictioneer_latest_stories type="compact" vertical="1" aspect_ratio="3/2"]
|
||||
[fictioneer_latest_stories type="compact" vertical="true" aspect_ratio="3/2"]
|
||||
```
|
||||
|
||||

|
||||
@ -1170,10 +1179,10 @@ Renders a multi-column grid of small cards, showing the latest four stories orde
|
||||
|
||||
### Latest Updates
|
||||
|
||||
Renders a multi-column grid of small cards, showing the latest four updated stories ordered by date of the last chapter change, descending.
|
||||
Renders a multi-column grid of small cards, showing the latest four updated stories ordered by date of the last chapter change, descending. Note that the `list` type behaves a bit different with the parameters.
|
||||
|
||||
* **count:** Limit updates to any positive number, although you should keep it reasonable. Default `4`.
|
||||
* **type:** Either `default`, `simple`, `single`, or `compact`. The other variants are smaller with less data.
|
||||
* **type:** Either `default`, `simple`, `single`, `compact`, or `list`. The other variants are smaller with less data.
|
||||
* **single:** Whether to show only one chapter item (included in type `single`). Default `false`.
|
||||
* **author:** Only show updates of a specific author. Make sure to use the url-safe nice_name.
|
||||
* **order:** Either `desc` (descending) or `asc` (ascending). Default `desc`.
|
||||
@ -1189,7 +1198,7 @@ Renders a multi-column grid of small cards, showing the latest four updated stor
|
||||
* **genres:** Comma-separated list of genre names (case-insensitive), if you want to pick from a curated pool.
|
||||
* **characters:** Comma-separated list of character names (case-insensitive), if you want to pick from a curated pool.
|
||||
* **rel:** Relationship between different taxonomies, either `AND` or `OR`. Default `AND`.
|
||||
* **source:** Set `false` to hide the author node. Default `true`.
|
||||
* **source:** Whether to show the author node. Default `true`.
|
||||
* **vertical:** Whether to render the cards with the image on top. Default `false`.
|
||||
* **seamless:** Whether to remove the gap between the image and frame. Default `false` (Customizer setting).
|
||||
* **thumbnail:** Whether to show the thumbnail/cover image. Default `true` (Customizer setting).
|
||||
@ -1198,7 +1207,12 @@ Renders a multi-column grid of small cards, showing the latest four updated stor
|
||||
* **aspect_ratio:** CSS [aspect-ratio](https://developer.mozilla.org/en-US/docs/Web/CSS/aspect-ratio) value for the image (X/Y; vertical only). Default `3/1`.
|
||||
* **words:** Whether to show the word count of chapter items. Default `true`.
|
||||
* **date:** Whether to show the date of chapter items. Default `true`.
|
||||
* **date_format:** String to override the [date format](https://wordpress.org/documentation/article/customize-date-and-time-format/). Default `''`.
|
||||
* **nested_date_format:** String to override any nested [date formats](https://wordpress.org/documentation/article/customize-date-and-time-format/). Default `''`.
|
||||
* **terms:** Either `inline`, `pills`, or `none` (only in type `list`). Default `inline`.
|
||||
* **max_terms:** Maximum number of shown taxonomies (only in type `list`). Default `10`.
|
||||
* **footer:** Whether to show the footer (if any). Default `true`.
|
||||
* **footer_author:** Whether to show the story/chapter author. Default `true`.
|
||||
* **footer_chapters:** Whether to show the story chapter count. Default `true`.
|
||||
* **footer_words:** Whether to show the story word count. Default `true`.
|
||||
* **footer_date:** Whether to show the modified date. Default `true`.
|
||||
@ -1219,15 +1233,15 @@ Renders a multi-column grid of small cards, showing the latest four updated stor
|
||||
```
|
||||
|
||||
```
|
||||
[fictioneer_latest_updates type="compact" order="asc" post_ids="13,106" seamless="1"]
|
||||
[fictioneer_latest_updates type="compact" order="asc" post_ids="13,106" seamless="true"]
|
||||
```
|
||||
|
||||
```
|
||||
[fictioneer_latest_updates type="compact" vertical="1" seamless="1"]
|
||||
[fictioneer_latest_updates type="compact" vertical="true" seamless="true"]
|
||||
```
|
||||
|
||||
```
|
||||
[fictioneer_latest_updates type="simple" single="1" date="0"]
|
||||
[fictioneer_latest_updates type="simple" single="true" date="0"]
|
||||
```
|
||||
|
||||

|
||||
|
36
FILTERS.md
36
FILTERS.md
@ -97,10 +97,11 @@ Filters the array of breadcrumb tuples inside the `fictioneer_get_breadcrumbs( $
|
||||
|
||||
---
|
||||
|
||||
### `apply_filters( 'fictioneer_filter_card_attributes', $post, $context )`
|
||||
### `apply_filters( 'fictioneer_filter_card_attributes', $attributes, $post, $context )`
|
||||
Filters the intermediate output array of HTML attributes inside the `.card` element before they are rendered. The keys are used as attribute names. Make sure to account for already existing attributes.
|
||||
|
||||
**Parameters:**
|
||||
* $attributes (array) - Associative array of attributes to be rendered.
|
||||
* $post (WP_Post) – The current post object.
|
||||
* $context (string|null) - Context regarding where or how the card is rendered. Unsafe.
|
||||
|
||||
@ -1018,7 +1019,7 @@ Filters the intermediate output array in the `_latest-chapters.php` partial befo
|
||||
|
||||
**Parameters**
|
||||
* $post (WP_Post) – The post object.
|
||||
* $story (array|null) – Optional. Collection of story post data.
|
||||
* $story (array|null) – Collection of story post data. Unsafe.
|
||||
* $args (array) – Arguments passed to the partial.
|
||||
|
||||
---
|
||||
@ -1251,6 +1252,37 @@ Filters the WP_Query arguments in the `fictioneer_latest_updates` shortcode. The
|
||||
|
||||
---
|
||||
|
||||
### `apply_filters( 'fictioneer_filter_shortcode_latest_{type}_list_meta', $meta, $post, $story, $chapter )`
|
||||
Filters the intermediate output array for the meta row in list-type shortcode partials before it is imploded and rendered. Can contain the story, chapter, word count, comment count, chapter count, publish date, author, status, and age rating depending on the shortcode and applied parameters. Type can be `chapter`, `stories`, or `updates`.
|
||||
|
||||
**Parameters**
|
||||
* $meta (array) – Associative array of HTML nodes to be rendered.
|
||||
* $post (WP_Post) – The current post object.
|
||||
* $story (array|null) – Collection of story post data. Unsafe.
|
||||
* $chapter (WP_Post|null) – The chapter post object (only for Latest Updates). Unsafe.
|
||||
|
||||
---
|
||||
|
||||
### `apply_filters( 'fictioneer_filter_shortcode_list_attributes', $attributes, $post, $context )`
|
||||
Filters the intermediate output array of HTML attributes inside list-type shortcodes before they are rendered. The keys are used as attribute names. Make sure to account for already existing attributes.
|
||||
|
||||
**Parameters:**
|
||||
* $attributes (array) - Associative array of attributes to be rendered.
|
||||
* $post (WP_Post) – The current post object.
|
||||
* $context (string) - Either `latest-chapters`, `latest-stories`, or `latest-updates`.
|
||||
|
||||
---
|
||||
|
||||
### `apply_filters( 'fictioneer_filter_shortcode_list_title', $title, $post, $context )`
|
||||
Filters the intermediate output array of HTML attributes inside list-type shortcodes before they are rendered. The keys are used as attribute names. Make sure to account for already existing attributes.
|
||||
|
||||
**Parameters:**
|
||||
* $title (string) – The current title to be rendered.
|
||||
* $post (WP_Post) – The current post object.
|
||||
* $context (string|null) - Either `latest-chapters`, `latest-stories`, or `latest-updates`.
|
||||
|
||||
---
|
||||
|
||||
### `apply_filters( 'fictioneer_filter_shortcode_showcase_query_args', $query_args, $args )`
|
||||
Filters the WP_Query arguments in the `fictioneer_showcase` shortcode. The optional taxonomy arrays can include categories, tags, fandoms, genres, and characters.
|
||||
|
||||
|
@ -3910,6 +3910,21 @@
|
||||
"pg" : 0,
|
||||
"sct" : 0
|
||||
},
|
||||
"\/src\/scss\/post-list.scss" : {
|
||||
"aP" : 0,
|
||||
"bl" : 0,
|
||||
"co" : 0,
|
||||
"dP" : 10,
|
||||
"ec" : 0,
|
||||
"ft" : 4,
|
||||
"ma" : 0,
|
||||
"oA" : 1,
|
||||
"oAP" : "\/css\/post-list.css",
|
||||
"oF" : 2,
|
||||
"oS" : 3,
|
||||
"pg" : 0,
|
||||
"sct" : 0
|
||||
},
|
||||
"\/src\/scss\/properties.scss" : {
|
||||
"aP" : 0,
|
||||
"bl" : 0,
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
:root .content-list-style-lines{--content-li-background: none;--card-content-li-background: none;--story-blog-li-background: none;--chapter-li-background: none;--chapter-li-padding-bottom-offset: var(--chapter-list-gap, 4px)}:root .content-list-style-lines :is(.chapter-group__list-item,.story__blog-list-item,.card__link-list-item){border-radius:0;border-bottom:var(--content-li-hr-border)}:root .content-list-style-lines .card__link-list-item{border-bottom:var(--card-content-li-hr-border, var(--content-li-hr-border));border-bottom-width:1px}:root .content-list-style-lines .card__link-list-item:last-child{margin-bottom:-0.125em}:root .content-list-style-lines .card__link-list-item:last-child{border-bottom:none}:root .content-list-style-lines .card ._small .cell-list:last-child{margin-bottom:calc(var(--this-spacing)*.65)}
|
||||
:root .content-list-style-lines{--content-li-background: none;--card-content-li-background: none;--story-blog-li-background: none;--chapter-li-background: none;--chapter-li-padding-bottom-offset: var(--chapter-list-gap, var(--content-list-gap, 4px))}:root .content-list-style-lines :is(.chapter-group__list-item,.story__blog-list-item,.card__link-list-item){border-radius:0;border-bottom:var(--content-li-hr-border)}:root .content-list-style-lines .card__link-list-item{border-bottom:var(--card-content-li-hr-border, var(--content-li-hr-border));border-bottom-width:1px}:root .content-list-style-lines .card__link-list-item:last-child{margin-bottom:-0.125em}:root .content-list-style-lines .card__link-list-item:last-child{border-bottom:none}:root .content-list-style-lines .card ._small .cell-list:last-child{margin-bottom:calc(var(--this-spacing)*.65)}
|
||||
|
1
css/post-list.css
Normal file
1
css/post-list.css
Normal file
@ -0,0 +1 @@
|
||||
.post-list{display:flex;flex-direction:column;gap:var(--post-list-gap, var(--content-list-gap, 4px));container-type:inline-size}.post-list-item{position:relative;display:grid;grid-template-columns:auto 1fr;grid-template-areas:"img ts" "img title" "img meta" "img bs";background:var(--post-list-li-background, var(--content-li-background));line-height:1.3;padding:.5rem 8px .5rem 0;border-radius:var(--layout-border-radius-small)}.post-list-item:is(._latest-updates,._latest-stories):not(._no-tax){grid-template-areas:"img ts" "img title" "img meta" "img tax" "img bs"}.post-list-item._no-footer{grid-template-areas:"img ts" "img title" "img bs"}.post-list-item._no-footer:is(._latest-updates,._latest-stories):not(._no-tax){grid-template-areas:"img ts" "img title" "img tax" "img bs"}.post-list-item._seamless{grid-template-rows:.5rem auto auto .5rem;padding:0 8px 0 0}.post-list-item._seamless .post-list-item__image{height:100%;width:3rem}.post-list-item._seamless .post-list-item__image img{--layout-nested-border-radius-multiplier: 1;height:100%}.post-list-item._seamless:is(._latest-updates,._latest-stories):not(._no-tax){grid-template-rows:.5rem auto auto auto .5rem}.post-list-item._seamless._full .post-list-item__image img{border-top-right-radius:0;border-bottom-right-radius:0}.post-list-item._no-footer-date .post-list-item__title{padding-right:0}.post-list-item._no-thumbnail{padding-left:2px}.post-list-item._full:not(._seamless){padding-left:8px}.post-list-item._full._seamless._no-thumbnail{padding-left:10px}.post-list-item._lines:not(:last-child){border-bottom:var(--content-li-hr-border);padding-bottom:calc(.5rem + var(--post-list-gap, var(--content-list-gap, 4px)))}.post-list-item._lines:not(:last-child)._seamless{padding-bottom:var(--post-list-gap, var(--content-list-gap, 4px))}.post-list-item__image{grid-area:img;align-self:center;margin-right:.75rem;width:2.5rem}.post-list-item__image[data-lightbox]{cursor:zoom-in}.post-list-item__image img{aspect-ratio:var(--post-item-image-aspect-ratio, 2/2.5);display:block;border-radius:calc(var(--layout-border-radius-small)*var(--layout-nested-border-radius-multiplier, 1));height:auto;width:100%;object-fit:cover}.post-list-item__title{grid-area:title;color:var(--post-list-title-color, var(--heading-link-color));font-family:var(--ff-post-list-title, var(--ff-heading));font-weight:var(--font-weight-medium);font-size:get_clamp(13, 14, 320, 768);font-size:var(--post-list-title-font-size, clamp(13px, 4.1cqw, 14px));margin-right:128px;width:fit-content}.post-list-item__title .protected-icon{font-size:.8em;margin-right:.125em;opacity:.9;transform:translateY(-0.125em)}@container (max-width: 639px){.post-list-item__title{margin-right:0}}.post-list-item__meta,.post-list-item__tax{grid-area:meta;color:var(--post-list-meta-color, var(--fg-600));font-family:var(--ff-post-list-meta, var(--ff-note));font-size:var(--post-list-meta-font-size, 13px);font-size:var(--post-list-meta-font-size, clamp(12px, 3.5cqw, 13px));line-height:1.5;margin-top:4px}.post-list-item__meta a:hover,.post-list-item__tax a:hover{--layout-link-color-hover: var(--post-list-meta-link-color-hover, var(--fg-200))}.post-list-item__meta .chapter-link-icon{color:var(--fg-800);line-height:inherit;margin-right:.25em}.post-list-item__meta-chapter,.post-list-item__meta-in-story{display:block;margin-bottom:3px}@container (min-width: 550px){.post-list-item__meta-chapter,.post-list-item__meta-in-story{display:inline}}.post-list-item__tax{grid-area:tax;margin-top:6px}.post-list-item__tax._pills{display:flex;gap:6px;flex-wrap:wrap}.post-list-item__tax .tag-pill._inline{font-size:inherit}.post-list-item ._pseudo-separator>*:where(:not(:first-child))::before{content:var(--post-list-separator, "• ");color:var(--post-list-meta-divider-color, var(--fg-800));font-family:var(--ff-base);margin:0 .125em}.post-list-item :where(._floating-right){position:absolute;top:.5rem;right:8px;opacity:.5}.post-list-item :where(._floating-right)::before{display:none}@container (max-width: 639px){.post-list-item :where(._floating-right){position:static;opacity:1}.post-list-item :where(._floating-right)::before{display:inline}}
|
@ -2300,26 +2300,26 @@ function fictioneer_add_layout_customizer_settings( $manager ) {
|
||||
)
|
||||
);
|
||||
|
||||
// Chapter list gap
|
||||
// Content list gap
|
||||
$manager->add_setting(
|
||||
'chapter_list_gap',
|
||||
'content_list_gap',
|
||||
array(
|
||||
'capability' => 'edit_theme_options',
|
||||
'sanitize_callback' => 'absint',
|
||||
'default' => apply_filters( 'fictioneer_filter_customizer_chapter_list_gap_default', 4 )
|
||||
'default' => apply_filters( 'fictioneer_filter_customizer_content_list_gap_default', 4 )
|
||||
)
|
||||
);
|
||||
|
||||
$manager->add_control(
|
||||
'chapter_list_gap',
|
||||
'content_list_gap',
|
||||
array(
|
||||
'type' => 'number',
|
||||
'priority' => 62,
|
||||
'section' => 'layout',
|
||||
'label' => __( 'Chapter List Gap', 'fictioneer' ),
|
||||
'description' => __( 'The gap between chapter list items in pixels (not grid view). Default 4.', 'fictioneer' ),
|
||||
'label' => __( 'Content List Gap', 'fictioneer' ),
|
||||
'description' => __( 'The gap between content list items in pixels (not grid view). Default 4.', 'fictioneer' ),
|
||||
'input_attrs' => array(
|
||||
'placeholder' => strval( apply_filters( 'fictioneer_filter_customizer_chapter_list_gap_default', 4 ) ),
|
||||
'placeholder' => strval( apply_filters( 'fictioneer_filter_customizer_content_list_gap_default', 4 ) ),
|
||||
'style' => 'width: 80px',
|
||||
'min' => 0
|
||||
)
|
||||
|
@ -824,7 +824,7 @@ function fictioneer_build_customize_css( $context = null ) {
|
||||
$large_border_radius = (int) get_theme_mod( 'large_border_radius', 4 );
|
||||
$small_border_radius = (int) get_theme_mod( 'small_border_radius', 2 );
|
||||
$nested_border_radius_multiplier = max( 0, get_theme_mod( 'nested_border_radius_multiplier', 1 ) );
|
||||
$chapter_list_gap = (int) get_theme_mod( 'chapter_list_gap', 4 );
|
||||
$content_list_gap = (int) get_theme_mod( 'content_list_gap', 4 );
|
||||
|
||||
$css .= ":root, :root[data-theme=base] {
|
||||
--layout-spacing-vertical: " . fictioneer_get_css_clamp( $vertical_min, $vertical_max, 480, $site_width ) . ";
|
||||
@ -833,7 +833,8 @@ function fictioneer_build_customize_css( $context = null ) {
|
||||
--layout-border-radius-large: {$large_border_radius}px;
|
||||
--layout-border-radius-small: {$small_border_radius}px;
|
||||
--layout-nested-border-radius-multiplier: {$nested_border_radius_multiplier};
|
||||
--chapter-list-gap: {$chapter_list_gap}px;
|
||||
--chapter-list-gap: {$content_list_gap}px;
|
||||
--content-list-gap: {$content_list_gap}px;
|
||||
}";
|
||||
|
||||
if ( $sidebar_style !== 'none' ) {
|
||||
|
@ -203,6 +203,8 @@ function fictioneer_get_default_shortcode_args( $attr, $def_count = -1 ) {
|
||||
'lightbox' => filter_var( $attr['lightbox'] ?? 1, FILTER_VALIDATE_BOOLEAN ),
|
||||
'words' => filter_var( $attr['words'] ?? 1, FILTER_VALIDATE_BOOLEAN ),
|
||||
'date' => filter_var( $attr['date'] ?? 1, FILTER_VALIDATE_BOOLEAN ),
|
||||
'date_format' => sanitize_text_field( $attr['date_format'] ?? '' ),
|
||||
'nested_date_format' => sanitize_text_field( $attr['nested_date_format'] ?? '' ),
|
||||
'footer' => filter_var( $attr['footer'] ?? 1, FILTER_VALIDATE_BOOLEAN ),
|
||||
'footer_author' => filter_var( $attr['footer_author'] ?? 1, FILTER_VALIDATE_BOOLEAN ),
|
||||
'footer_chapters' => filter_var( $attr['footer_chapters'] ?? 1, FILTER_VALIDATE_BOOLEAN ),
|
||||
@ -462,7 +464,7 @@ add_shortcode( 'fictioneer_showcase', 'fictioneer_shortcode_showcase' );
|
||||
* @param string|null $attr['order'] Optional. Order argument. Default 'DESC'.
|
||||
* @param string|null $attr['orderby'] Optional. Orderby argument. Default 'date'.
|
||||
* @param string|null $attr['spoiler'] Optional. Whether to show spoiler content.
|
||||
* @param string|null $attr['source'] Optional. Whether to show author and story.
|
||||
* @param string|null $attr['source'] Optional. Whether to show the author and story.
|
||||
* @param string|null $attr['post_ids'] Optional. Limit posts to specific post IDs.
|
||||
* @param string|null $attr['ignore_protected'] Optional. Whether to ignore protected posts. Default false.
|
||||
* @param string|null $attr['author_ids'] Optional. Only include posts by these author IDs.
|
||||
@ -480,6 +482,14 @@ add_shortcode( 'fictioneer_showcase', 'fictioneer_shortcode_showcase' );
|
||||
* @param string|null $attr['aspect_ratio'] Optional. Aspect ratio for the image. Only with vertical.
|
||||
* @param string|null $attr['lightbox'] Optional. Whether the thumbnail is opened in the lightbox. Default true.
|
||||
* @param string|null $attr['thumbnail'] Optional. Whether to show the thumbnail. Default true (Customizer).
|
||||
* @param string|null $attr['date_format'] Optional. String to override the date format. Default empty.
|
||||
* @param string|null $attr['footer'] Optional. Whether to show the footer (if any). Default true.
|
||||
* @param string|null $attr['footer_author'] Optional. Whether to show the chapter author. Default true.
|
||||
* @param string|null $attr['footer_date'] Optional. Whether to show the chapter date. Default true.
|
||||
* @param string|null $attr['footer_words'] Optional. Whether to show the chapter word count. Default true.
|
||||
* @param string|null $attr['footer_comments'] Optional. Whether to show the chapter comment count. Default true.
|
||||
* @param string|null $attr['footer_status'] Optional. Whether to show the chapter status. Default true.
|
||||
* @param string|null $attr['footer_rating'] Optional. Whether to show the story/chapter age rating. Default true.
|
||||
* @param string|null $attr['class'] Optional. Additional CSS classes, separated by whitespace.
|
||||
*
|
||||
* @return string The captured shortcode HTML.
|
||||
@ -514,6 +524,9 @@ function fictioneer_shortcode_latest_chapters( $attr ) {
|
||||
case 'compact':
|
||||
get_template_part( 'partials/_latest-chapters-compact', null, $args );
|
||||
break;
|
||||
case 'list':
|
||||
get_template_part( 'partials/_latest-chapters-list', null, $args );
|
||||
break;
|
||||
default:
|
||||
$args['simple'] = $type == 'simple';
|
||||
get_template_part( 'partials/_latest-chapters', null, $args );
|
||||
@ -563,6 +576,17 @@ add_shortcode( 'fictioneer_chapter_cards', 'fictioneer_shortcode_latest_chapters
|
||||
* @param string|null $attr['aspect_ratio'] Optional. Aspect ratio for the image. Only with vertical.
|
||||
* @param string|null $attr['lightbox'] Optional. Whether the thumbnail is opened in the lightbox. Default true.
|
||||
* @param string|null $attr['thumbnail'] Optional. Whether to show the thumbnail. Default true (Customizer).
|
||||
* @param string|null $attr['date_format'] Optional. String to override the date format. Default empty.
|
||||
* @param string|null $attr['terms'] Optional. Either 'inline', 'pills', 'none', or 'false' (only in list type).
|
||||
* Default 'inline'.
|
||||
* @param string|null $attr['max_terms'] Optional. Maximum number of shown taxonomies. Default 10.
|
||||
* @param string|null $attr['footer'] Optional. Whether to show the footer (if any). Default true.
|
||||
* @param string|null $attr['footer_author'] Optional. Whether to show the story author. Default true.
|
||||
* @param string|null $attr['footer_date'] Optional. Whether to show the story date. Default true.
|
||||
* @param string|null $attr['footer_words'] Optional. Whether to show the story word count. Default true.
|
||||
* @param string|null $attr['footer_chapters'] Optional. Whether to show the story chapter count. Default true.
|
||||
* @param string|null $attr['footer_status'] Optional. Whether to show the story status. Default true.
|
||||
* @param string|null $attr['footer_rating'] Optional. Whether to show the story age rating. Default true.
|
||||
* @param string|null $attr['class'] Optional. Additional CSS classes, separated by whitespace.
|
||||
*
|
||||
* @return string The captured shortcode HTML.
|
||||
@ -575,6 +599,10 @@ function fictioneer_shortcode_latest_stories( $attr ) {
|
||||
// Type
|
||||
$type = sanitize_text_field( $attr['type'] ?? 'default' );
|
||||
|
||||
// Terms
|
||||
$args['terms'] = fictioneer_sanitize_query_var( $attr['terms'] ?? 0, ['inline', 'pills', 'none', 'false'], 'inline' );
|
||||
$args['max_terms'] = absint( $attr['max_terms'] ?? 10 );
|
||||
|
||||
// Transient?
|
||||
if ( FICTIONEER_SHORTCODE_TRANSIENTS_ENABLED ) {
|
||||
$base = serialize( $args ) . serialize( $attr );
|
||||
@ -593,6 +621,9 @@ function fictioneer_shortcode_latest_stories( $attr ) {
|
||||
case 'compact':
|
||||
get_template_part( 'partials/_latest-stories-compact', null, $args );
|
||||
break;
|
||||
case 'list':
|
||||
get_template_part( 'partials/_latest-stories-list', null, $args );
|
||||
break;
|
||||
default:
|
||||
get_template_part( 'partials/_latest-stories', null, $args );
|
||||
}
|
||||
@ -642,6 +673,18 @@ add_shortcode( 'fictioneer_story_cards', 'fictioneer_shortcode_latest_stories' )
|
||||
* @param string|null $attr['thumbnail'] Optional. Whether to show the thumbnail. Default true (Customizer).
|
||||
* @param string|null $attr['words'] Optional. Whether to show the word count of chapter items. Default true.
|
||||
* @param string|null $attr['date'] Optional. Whether to show the date of chapter items. Default true.
|
||||
* @param string|null $attr['date_format'] Optional. String to override the date format. Default empty.
|
||||
* @param string|null $attr['nested_date_format'] Optional. String to override any nested date formats. Default empty.
|
||||
* @param string|null $attr['terms'] Optional. Either 'inline', 'pills', 'none', or 'false' (only in list type).
|
||||
* Default 'inline'.
|
||||
* @param string|null $attr['max_terms'] Optional. Maximum number of shown taxonomies. Default 10.
|
||||
* @param string|null $attr['footer'] Optional. Whether to show the footer (if any). Default true.
|
||||
* @param string|null $attr['footer_author'] Optional. Whether to show the story author. Default true.
|
||||
* @param string|null $attr['footer_date'] Optional. Whether to show the story date. Default true.
|
||||
* @param string|null $attr['footer_words'] Optional. Whether to show the story word count. Default true.
|
||||
* @param string|null $attr['footer_chapters'] Optional. Whether to show the story chapter count. Default true.
|
||||
* @param string|null $attr['footer_status'] Optional. Whether to show the story status. Default true.
|
||||
* @param string|null $attr['footer_rating'] Optional. Whether to show the story/chapter age rating. Default true.
|
||||
* @param string|null $attr['class'] Optional. Additional CSS classes, separated by whitespace.
|
||||
*
|
||||
* @return string The captured shortcode HTML.
|
||||
@ -655,6 +698,10 @@ function fictioneer_shortcode_latest_story_updates( $attr ) {
|
||||
// Type
|
||||
$type = sanitize_text_field( $attr['type'] ?? 'default' );
|
||||
|
||||
// Terms
|
||||
$args['terms'] = fictioneer_sanitize_query_var( $attr['terms'] ?? 0, ['inline', 'pills', 'none', 'false'], 'inline' );
|
||||
$args['max_terms'] = absint( $attr['max_terms'] ?? 10 );
|
||||
|
||||
// Transient?
|
||||
if ( FICTIONEER_SHORTCODE_TRANSIENTS_ENABLED ) {
|
||||
$base = serialize( $args ) . serialize( $attr );
|
||||
@ -673,6 +720,9 @@ function fictioneer_shortcode_latest_story_updates( $attr ) {
|
||||
case 'compact':
|
||||
get_template_part( 'partials/_latest-updates-compact', null, $args );
|
||||
break;
|
||||
case 'list':
|
||||
get_template_part( 'partials/_latest-updates-list', null, $args );
|
||||
break;
|
||||
default:
|
||||
get_template_part( 'partials/_latest-updates', null, $args );
|
||||
}
|
||||
@ -1539,6 +1589,11 @@ add_shortcode( 'fictioneer_blog', 'fictioneer_shortcode_blog' );
|
||||
* @param string|null $attr['aspect_ratio'] Optional. Aspect ratio for the image.
|
||||
* @param string|null $attr['lightbox'] Optional. Whether the thumbnail is opened in the lightbox. Default true.
|
||||
* @param string|null $attr['thumbnail'] Optional. Whether to show the thumbnail. Default true (Customizer).
|
||||
* @param string|null $attr['date_format'] Optional. String to override the date format. Default empty.
|
||||
* @param string|null $attr['footer'] Optional. Whether to show the footer (if any). Default true.
|
||||
* @param string|null $attr['footer_author'] Optional. Whether to show the post author. Default true.
|
||||
* @param string|null $attr['footer_date'] Optional. Whether to show the post date. Default true.
|
||||
* @param string|null $attr['footer_comments'] Optional. Whether to show the post comment count. Default true.
|
||||
* @param string|null $attr['class'] Optional. Additional CSS classes, separated by whitespace.
|
||||
*
|
||||
* @return string The captured shortcode HTML.
|
||||
|
@ -801,6 +801,8 @@ add_action( 'customize_save_after', 'fictioneer_regenerate_cache_bust' );
|
||||
*/
|
||||
|
||||
function fictioneer_style_queue() {
|
||||
global $post;
|
||||
|
||||
// Setup
|
||||
$cache_bust = fictioneer_get_cache_bust();
|
||||
|
||||
@ -886,6 +888,16 @@ function fictioneer_style_queue() {
|
||||
$cache_bust
|
||||
);
|
||||
}
|
||||
|
||||
// Shortcodes
|
||||
if ( preg_match( '/\[fictioneer_latest_[^\]]*type="list"[^\]]*\]/', $post->post_content ) ) {
|
||||
wp_enqueue_style(
|
||||
'fictioneer-post-list',
|
||||
get_template_directory_uri() . '/css/post-list.css',
|
||||
['fictioneer-application'],
|
||||
$cache_bust
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Archive
|
||||
@ -1429,27 +1441,6 @@ function fictioneer_ao_exclude_css( $exclude ) {
|
||||
}
|
||||
add_filter( 'autoptimize_filter_css_exclude', 'fictioneer_ao_exclude_css', 10, 1 );
|
||||
|
||||
/**
|
||||
* Turn off script optimization for admins and editors
|
||||
*
|
||||
* @since 5.20.0
|
||||
* @link https://developer.wordpress.org/reference/hooks/pre_option_option/
|
||||
*
|
||||
* @param mixed $pre_option The value to return instead of the option value
|
||||
* @param string $option Option name.
|
||||
*
|
||||
* @return mixed The updated or original option value.
|
||||
*/
|
||||
|
||||
function fictioneer_override_autoptimize_optimize_logged_option( $value, $option ) {
|
||||
if ( $option === 'autoptimize_optimize_logged' ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
add_filter( 'pre_option_autoptimize_optimize_logged', 'fictioneer_override_autoptimize_optimize_logged_option', 10, 2 );
|
||||
|
||||
// =============================================================================
|
||||
// OUTPUT HEAD FONTS
|
||||
// =============================================================================
|
||||
|
@ -1740,6 +1740,7 @@ function fictioneer_sanitize_url( $url, $match = null, $preg_match = null ) {
|
||||
* Sanitizes a CSS aspect ratio value
|
||||
*
|
||||
* @since 5.14.0
|
||||
* @since 5.23.0 - Refactored to accept fractional values.
|
||||
*
|
||||
* @param string $css The CSS value to be sanitized.
|
||||
* @param string $default Optional default value.
|
||||
@ -1752,13 +1753,18 @@ function sanitize_css_aspect_ratio( $css, $default = false ) {
|
||||
$css = trim( $css );
|
||||
|
||||
// Validate
|
||||
if ( preg_match( '/^\d+\/\d+$/', $css ) ) {
|
||||
if ( preg_match( '/^\d+(\.\d+)?\/\d+(\.\d+)?$/', $css ) ) {
|
||||
// Split based on the slash '/'
|
||||
list( $numerator, $denominator ) = explode( '/', $css, 2 );
|
||||
|
||||
// Sanitize parts
|
||||
$numerator = absint( $numerator );
|
||||
$denominator = absint( $denominator );
|
||||
$numerator = max( 0, floatval( $numerator ) );
|
||||
$denominator = max( 0, floatval( $denominator ) );
|
||||
|
||||
// Nonsense?
|
||||
if ( $numerator == 0 || $denominator == 0 ) {
|
||||
return $default;
|
||||
}
|
||||
|
||||
// Combine and return
|
||||
return $numerator . '/' . $denominator;
|
||||
|
@ -8,28 +8,29 @@
|
||||
* @subpackage Fictioneer
|
||||
* @since 5.7.3
|
||||
*
|
||||
* @internal $args['post_type'] Array of post types to query. Default 'post'.
|
||||
* @internal $args['ignore_sticky'] Whether to ignore sticky flags. Default false.
|
||||
* @internal $args['ignore_protected'] Whether to ignore protected posts. Default false.
|
||||
* @internal $args['count'] Number of posts to display. Default -1.
|
||||
* @internal $args['author'] Author to query posts for. Default empty.
|
||||
* @internal $args['order'] Order of posts. Default 'DESC'.
|
||||
* @internal $args['orderby'] Sorting of posts. Default 'date'.
|
||||
* @internal $args['page'] The current page. Default 1.
|
||||
* @internal $args['post_ids'] Array of post IDs. Default empty.
|
||||
* @internal $args['author_ids'] Array of author IDs. Default empty.
|
||||
* @internal $args['excluded_authors'] Array of author IDs to exclude. Default empty.
|
||||
* @internal $args['excluded_cats'] Array of category IDs to exclude. Default empty.
|
||||
* @internal $args['excluded_tags'] Array of tag IDs to exclude. Default empty.
|
||||
* @internal $args['taxonomies'] Array of taxonomy arrays. Default empty.
|
||||
* @internal $args['relation'] Relationship between taxonomies. Default 'AND'.
|
||||
* @internal $args['lightbox'] Whether the image is opened in the lightbox. Default true.
|
||||
* @internal $args['thumbnail'] Whether the image is rendered. Default true.
|
||||
* @internal $args['footer'] Whether to show the footer. Default true.
|
||||
* @internal $args['footer_author'] Whether to show the post author. Default true.
|
||||
* @internal $args['footer_date'] Whether to show the post date. Default true.
|
||||
* @internal $args['footer_comments'] Whether to show the post comment count. Default true.
|
||||
* @internal $args['classes'] String of additional CSS classes. Default empty.
|
||||
* @internal $args['post_type'] Array of post types to query. Default 'post'.
|
||||
* @internal $args['ignore_sticky'] Whether to ignore sticky flags. Default false.
|
||||
* @internal $args['ignore_protected'] Whether to ignore protected posts. Default false.
|
||||
* @internal $args['count'] Number of posts to display. Default -1.
|
||||
* @internal $args['author'] Author to query posts for. Default empty.
|
||||
* @internal $args['order'] Order of posts. Default 'DESC'.
|
||||
* @internal $args['orderby'] Sorting of posts. Default 'date'.
|
||||
* @internal $args['page'] The current page. Default 1.
|
||||
* @internal $args['post_ids'] Array of post IDs. Default empty.
|
||||
* @internal $args['author_ids'] Array of author IDs. Default empty.
|
||||
* @internal $args['excluded_authors'] Array of author IDs to exclude. Default empty.
|
||||
* @internal $args['excluded_cats'] Array of category IDs to exclude. Default empty.
|
||||
* @internal $args['excluded_tags'] Array of tag IDs to exclude. Default empty.
|
||||
* @internal $args['taxonomies'] Array of taxonomy arrays. Default empty.
|
||||
* @internal $args['relation'] Relationship between taxonomies. Default 'AND'.
|
||||
* @internal $args['lightbox'] Whether the image is opened in the lightbox. Default true.
|
||||
* @internal $args['thumbnail'] Whether the image is rendered. Default true.
|
||||
* @internal $args['date_format'] String to override the date format. Default empty.
|
||||
* @internal $args['footer'] Whether to show the footer. Default true.
|
||||
* @internal $args['footer_author'] Whether to show the post author. Default true.
|
||||
* @internal $args['footer_date'] Whether to show the post date. Default true.
|
||||
* @internal $args['footer_comments'] Whether to show the post comment count. Default true.
|
||||
* @internal $args['classes'] String of additional CSS classes. Default empty.
|
||||
*/
|
||||
|
||||
|
||||
@ -270,10 +271,12 @@ $pag_args = array(
|
||||
}
|
||||
|
||||
if ( $args['footer_date'] ) {
|
||||
$format = $args['date_format'] ?: FICTIONEER_CARD_ARTICLE_FOOTER_DATE;
|
||||
|
||||
if ( $args['orderby'] === 'modified' ) {
|
||||
$footer_items['modified_date'] = '<span class="card__footer-modified-date"><i class="card-footer-icon fa-regular fa-clock" title="' . esc_attr__( 'Last Updated', 'fictioneer' ) . '"></i> ' . get_the_modified_date( FICTIONEER_CARD_ARTICLE_FOOTER_DATE, $post ) . '</span>';
|
||||
$footer_items['modified_date'] = '<span class="card__footer-modified-date"><i class="card-footer-icon fa-regular fa-clock" title="' . esc_attr__( 'Last Updated', 'fictioneer' ) . '"></i> ' . get_the_modified_date( $format, $post ) . '</span>';
|
||||
} else {
|
||||
$footer_items['publish_date'] = '<span class="card__footer-publish-date"><i class="card-footer-icon fa-solid fa-clock" title="' . esc_attr__( 'Published', 'fictioneer' ) .'"></i> ' . get_the_date( FICTIONEER_CARD_ARTICLE_FOOTER_DATE ) . '</span>';
|
||||
$footer_items['publish_date'] = '<span class="card__footer-publish-date"><i class="card-footer-icon fa-solid fa-clock" title="' . esc_attr__( 'Published', 'fictioneer' ) .'"></i> ' . get_the_date( $format ) . '</span>';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,33 +8,33 @@
|
||||
* @subpackage Fictioneer
|
||||
* @since 4.0.0
|
||||
*
|
||||
* @internal $args['type'] Type argument passed from shortcode ('compact').
|
||||
* @internal $args['count'] Number of posts provided by the shortcode.
|
||||
* @internal $args['author'] Author provided by the shortcode.
|
||||
* @internal $args['order'] Order of posts. Default 'DESC'.
|
||||
* @internal $args['orderby'] Sorting of posts. Default 'date'.
|
||||
* @internal $args['spoiler'] Whether to obscure or show chapter excerpt.
|
||||
* @internal $args['source'] Whether to show author and story.
|
||||
* @internal $args['post_ids'] Array of post IDs. Default empty.
|
||||
* @internal $args['author_ids'] Array of author IDs. Default empty.
|
||||
* @internal $args['excluded_authors'] Array of author IDs to exclude. Default empty.
|
||||
* @internal $args['excluded_cats'] Array of category IDs to exclude. Default empty.
|
||||
* @internal $args['excluded_tags'] Array of tag IDs to exclude. Default empty.
|
||||
* @internal $args['ignore_protected'] Whether to ignore protected posts. Default false.
|
||||
* @internal $args['taxonomies'] Array of taxonomy arrays. Default empty.
|
||||
* @internal $args['relation'] Relationship between taxonomies.
|
||||
* @internal $args['vertical'] Whether to show the vertical variant.
|
||||
* @internal $args['seamless'] Whether to render the image seamless. Default false (Customizer).
|
||||
* @internal $args['aspect_ratio'] Aspect ratio for the image. Only with vertical.
|
||||
* @internal $args['lightbox'] Whether the image is opened in the lightbox. Default true.
|
||||
* @internal $args['thumbnail'] Whether the image is rendered. Default true (Customizer).
|
||||
* @internal $args['classes'] String of additional CSS classes. Default empty.
|
||||
* @internal $args['infobox'] Whether to show the info box and toggle.
|
||||
* @internal $args['footer_words'] Whether to show the chapter word count. Default true.
|
||||
* @internal $args['footer_date'] Whether to show the chapter date. Default true.
|
||||
* @internal $args['footer_comments'] Whether to show the chapter comment count. Default true.
|
||||
* @internal $args['footer_status'] Whether to show the chapter story status. Default true.
|
||||
* @internal $args['footer_rating'] Whether to show the chapter age rating. Default true.
|
||||
* @internal $args['type'] Type argument passed from shortcode ('compact').
|
||||
* @internal $args['count'] Number of posts provided by the shortcode.
|
||||
* @internal $args['author'] Author provided by the shortcode.
|
||||
* @internal $args['order'] Order of posts. Default 'DESC'.
|
||||
* @internal $args['orderby'] Sorting of posts. Default 'date'.
|
||||
* @internal $args['spoiler'] Whether to obscure or show chapter excerpt.
|
||||
* @internal $args['source'] Whether to show author and story.
|
||||
* @internal $args['post_ids'] Array of post IDs. Default empty.
|
||||
* @internal $args['author_ids'] Array of author IDs. Default empty.
|
||||
* @internal $args['excluded_authors'] Array of author IDs to exclude. Default empty.
|
||||
* @internal $args['excluded_cats'] Array of category IDs to exclude. Default empty.
|
||||
* @internal $args['excluded_tags'] Array of tag IDs to exclude. Default empty.
|
||||
* @internal $args['ignore_protected'] Whether to ignore protected posts. Default false.
|
||||
* @internal $args['taxonomies'] Array of taxonomy arrays. Default empty.
|
||||
* @internal $args['relation'] Relationship between taxonomies.
|
||||
* @internal $args['vertical'] Whether to show the vertical variant.
|
||||
* @internal $args['seamless'] Whether to render the image seamless. Default false (Customizer).
|
||||
* @internal $args['aspect_ratio'] Aspect ratio for the image. Only with vertical.
|
||||
* @internal $args['lightbox'] Whether the image is opened in the lightbox. Default true.
|
||||
* @internal $args['thumbnail'] Whether the image is rendered. Default true (Customizer).
|
||||
* @internal $args['classes'] String of additional CSS classes. Default empty.
|
||||
* @internal $args['infobox'] Whether to show the info box and toggle.
|
||||
* @internal $args['date_format'] String to override the date format. Default empty.
|
||||
* @internal $args['nested_date_format'] String to override the date format of nested items. Default empty.
|
||||
* @internal $args['footer_author'] Whether to show the chapter author. Default true.
|
||||
* @internal $args['footer_words'] Whether to show the chapter word count. Default true.
|
||||
* @internal $args['footer_date'] Whether to show the chapter date. Default true.
|
||||
*/
|
||||
|
||||
|
||||
@ -168,18 +168,6 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
$card_classes[] = '_no-footer-date';
|
||||
}
|
||||
|
||||
if ( ! $args['footer_comments'] ) {
|
||||
$card_classes[] = '_no-footer-comments';
|
||||
}
|
||||
|
||||
if ( ! $args['footer_status'] ) {
|
||||
$card_classes[] = '_no-footer-status';
|
||||
}
|
||||
|
||||
if ( ! $args['footer_rating'] ) {
|
||||
$card_classes[] = '_no-footer-rating';
|
||||
}
|
||||
|
||||
// Count actually rendered cards to account for buffer
|
||||
if ( ++$card_counter > $args['count'] ) {
|
||||
break;
|
||||
@ -243,7 +231,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
|
||||
<div class="card__content _small cell-desc">
|
||||
<div class="text-overflow-ellipsis _bottom-spacer-xs">
|
||||
<?php if ( get_option( 'fictioneer_show_authors' ) && $args['source'] ) : ?>
|
||||
<?php if ( get_option( 'fictioneer_show_authors' ) && $args['source'] && $args['footer_author'] ) : ?>
|
||||
<span class="card__by-author"><?php
|
||||
printf( _x( 'by %s', 'Small card: by {Author}.', 'fictioneer' ), fictioneer_get_author_node() );
|
||||
?></span>
|
||||
@ -263,11 +251,13 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
</div>
|
||||
<div class="card__words-on-date text-overflow-ellipsis">
|
||||
<?php
|
||||
$format = $args['date_format'] ?: FICTIONEER_LATEST_CHAPTERS_FOOTER_DATE;
|
||||
|
||||
if ( $words > 0 && $args['footer_words'] && $args['footer_date'] ) {
|
||||
printf(
|
||||
_x( '%1$s Words on %2$s', 'Small card: {n} Words on {Date}.', 'fictioneer' ),
|
||||
fictioneer_shorten_number( fictioneer_get_word_count( $post_id ) ),
|
||||
get_the_time( FICTIONEER_LATEST_CHAPTERS_FOOTER_DATE )
|
||||
get_the_time( $format )
|
||||
);
|
||||
} else {
|
||||
if ( $words > 0 && $args['footer_words'] ) {
|
||||
@ -276,7 +266,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
fictioneer_shorten_number( fictioneer_get_word_count( $post_id ) )
|
||||
);
|
||||
} elseif ( $args['footer_date'] ) {
|
||||
the_time( FICTIONEER_LATEST_CHAPTERS_FOOTER_DATE );
|
||||
the_time( $format );
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
306
partials/_latest-chapters-list.php
Normal file
306
partials/_latest-chapters-list.php
Normal file
@ -0,0 +1,306 @@
|
||||
<?php
|
||||
/**
|
||||
* Partial: Latest Chapters List
|
||||
*
|
||||
* Renders the (buffered) HTML for the [fictioneer_latest_chapters type="list"] shortcode.
|
||||
*
|
||||
* @package WordPress
|
||||
* @subpackage Fictioneer
|
||||
* @since 5.23.0
|
||||
*
|
||||
* @internal $args['type'] Type argument passed from shortcode. Default 'default'.
|
||||
* @internal $args['count'] Number of posts provided by the shortcode.
|
||||
* @internal $args['author'] Author provided by the shortcode.
|
||||
* @internal $args['order'] Order of posts. Default 'DESC'.
|
||||
* @internal $args['orderby'] Sorting of posts. Default 'date'.
|
||||
* @internal $args['spoiler'] Whether to obscure or show chapter excerpt.
|
||||
* @internal $args['post_ids'] Array of post IDs. Default empty.
|
||||
* @internal $args['author_ids'] Array of author IDs. Default empty.
|
||||
* @internal $args['excluded_authors'] Array of author IDs to exclude. Default empty.
|
||||
* @internal $args['excluded_cats'] Array of category IDs to exclude. Default empty.
|
||||
* @internal $args['excluded_tags'] Array of tag IDs to exclude. Default empty.
|
||||
* @internal $args['ignore_protected'] Whether to ignore protected posts. Default false.
|
||||
* @internal $args['taxonomies'] Array of taxonomy arrays. Default empty.
|
||||
* @internal $args['relation'] Relationship between taxonomies.
|
||||
* @internal $args['spoiler'] Whether to obscure or show chapter excerpt.
|
||||
* @internal $args['source'] Whether to show author and story.
|
||||
* @internal $args['simple'] Whether to show the simple variant.
|
||||
* @internal $args['vertical'] Whether to show the vertical variant.
|
||||
* @internal $args['seamless'] Whether to render the image seamless. Default false (Customizer).
|
||||
* @internal $args['aspect_ratio'] Aspect ratio for the image. Only with vertical.
|
||||
* @internal $args['lightbox'] Whether the image is opened in the lightbox. Default true.
|
||||
* @internal $args['thumbnail'] Whether the image is rendered. Default true (Customizer).
|
||||
* @internal $args['date_format'] String to override the date format. Default empty.
|
||||
* @internal $args['footer'] Whether to show the footer. Default true.
|
||||
* @internal $args['footer_author'] Whether to show the chapter author. Default true.
|
||||
* @internal $args['footer_words'] Whether to show the chapter word count. Default true.
|
||||
* @internal $args['footer_date'] Whether to show the chapter date. Default true.
|
||||
* @internal $args['footer_status'] Whether to show the chapter story status. Default true.
|
||||
* @internal $args['footer_rating'] Whether to show the story/chapter age rating. Default true.
|
||||
* @internal $args['classes'] String of additional CSS classes. Default empty.
|
||||
*/
|
||||
|
||||
|
||||
// No direct access!
|
||||
defined( 'ABSPATH' ) OR exit;
|
||||
|
||||
// Setup
|
||||
$render_count = 0;
|
||||
$content_list_style = get_theme_mod( 'content_list_style', 'default' );
|
||||
|
||||
// Prepare query
|
||||
$query_args = array(
|
||||
'fictioneer_query_name' => 'latest_chapters_list',
|
||||
'post_type' => 'fcn_chapter',
|
||||
'post_status' => 'publish',
|
||||
'post__in' => $args['post_ids'], // May be empty!
|
||||
'orderby' => $args['orderby'],
|
||||
'order' => $args['order'],
|
||||
'posts_per_page' => $args['count'] + 8, // Little buffer in case of unpublished parent story
|
||||
'no_found_rows' => true,
|
||||
'update_post_term_cache' => false
|
||||
);
|
||||
|
||||
// Use extended meta query?
|
||||
if ( get_option( 'fictioneer_disable_extended_chapter_list_meta_queries' ) ) {
|
||||
$query_args['meta_key'] = 'fictioneer_chapter_hidden';
|
||||
$query_args['meta_value'] = '0';
|
||||
} else {
|
||||
$query_args['meta_query'] = array(
|
||||
'relation' => 'OR',
|
||||
array(
|
||||
'key' => 'fictioneer_chapter_hidden',
|
||||
'value' => '0'
|
||||
),
|
||||
array(
|
||||
'key' => 'fictioneer_chapter_hidden',
|
||||
'compare' => 'NOT EXISTS'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Author?
|
||||
if ( ! empty( $args['author'] ) ) {
|
||||
$query_args['author_name'] = $args['author'];
|
||||
}
|
||||
|
||||
// Author IDs?
|
||||
if ( ! empty( $args['author_ids'] ) ) {
|
||||
$query_args['author__in'] = $args['author_ids'];
|
||||
}
|
||||
|
||||
// Taxonomies?
|
||||
if ( ! empty( $args['taxonomies'] ) ) {
|
||||
$query_args['tax_query'] = fictioneer_get_shortcode_tax_query( $args );
|
||||
}
|
||||
|
||||
// Excluded tags?
|
||||
if ( ! empty( $args['excluded_tags'] ) ) {
|
||||
$query_args['tag__not_in'] = $args['excluded_tags'];
|
||||
}
|
||||
|
||||
// Excluded categories?
|
||||
if ( ! empty( $args['excluded_cats'] ) ) {
|
||||
$query_args['category__not_in'] = $args['excluded_cats'];
|
||||
}
|
||||
|
||||
// Excluded authors?
|
||||
if ( ! empty( $args['excluded_authors'] ) ) {
|
||||
$query_args['author__not_in'] = $args['excluded_authors'];
|
||||
}
|
||||
|
||||
// Ignore protected?
|
||||
if ( $args['ignore_protected'] ) {
|
||||
add_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
}
|
||||
|
||||
// Apply filters
|
||||
$query_args = apply_filters( 'fictioneer_filter_shortcode_latest_chapters_query_args', $query_args, $args );
|
||||
|
||||
// Query chapters
|
||||
$entries = fictioneer_shortcode_query( $query_args );
|
||||
|
||||
// Remove temporary filters
|
||||
remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
|
||||
?>
|
||||
|
||||
<section class="latest-chapters _list <?php echo $args['classes']; ?>">
|
||||
<?php if ( $entries->have_posts() ) : ?>
|
||||
|
||||
<ul class="post-list _latest-chapters">
|
||||
<?php while ( $entries->have_posts() ) : $entries->the_post(); ?>
|
||||
|
||||
<?php
|
||||
// Setup
|
||||
$post_id = $post->ID;
|
||||
$story_id = get_post_meta( $post_id, 'fictioneer_chapter_story', true );
|
||||
$story = $story_id ? fictioneer_get_story_data( $story_id, false ) : null; // Does not refresh comment count!
|
||||
|
||||
if ( get_post_status( $story_id ) !== 'publish' || ! $story ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Count actually rendered items to account for buffer
|
||||
if ( ++$render_count > $args['count'] ) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Continue setup
|
||||
$title = fictioneer_get_safe_title( $post_id, 'shortcode-latest-chapters-list' );
|
||||
$permalink = get_permalink( $post_id );
|
||||
$chapter_rating = get_post_meta( $post_id, 'fictioneer_chapter_rating', true );
|
||||
$words = fictioneer_get_word_count( $post_id );
|
||||
|
||||
// Thumbnail
|
||||
$thumbnail = null;
|
||||
|
||||
if ( $args['thumbnail'] ) {
|
||||
$thumbnail = fictioneer_render_thumbnail(
|
||||
array(
|
||||
'post_id' => $post_id,
|
||||
'title' => $title,
|
||||
'permalink' => $permalink,
|
||||
'size' => 'snippet',
|
||||
'classes' => 'post-list-item__image',
|
||||
'lightbox' => $args['lightbox'],
|
||||
'aspect_ratio' => $args['aspect_ratio'] ?? '2/2.5'
|
||||
),
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
// Extra classes
|
||||
$classes = [];
|
||||
|
||||
if ( ! empty( $post->post_password ) ) {
|
||||
$classes[] = '_password';
|
||||
}
|
||||
|
||||
if ( $args['seamless'] ) {
|
||||
$classes[] = '_seamless';
|
||||
}
|
||||
|
||||
if ( $content_list_style !== 'default' ) {
|
||||
$classes[] = "_{$content_list_style}";
|
||||
}
|
||||
|
||||
if ( ! $thumbnail ) {
|
||||
$classes[] = '_no-thumbnail';
|
||||
}
|
||||
|
||||
if ( ! $args['footer'] ) {
|
||||
$classes[] = '_no-footer';
|
||||
}
|
||||
|
||||
if ( ! $args['footer_author'] ) {
|
||||
$classes[] = '_no-footer-author';
|
||||
}
|
||||
|
||||
if ( ! $args['footer_words'] ) {
|
||||
$classes[] = '_no-footer-words';
|
||||
}
|
||||
|
||||
if ( ! $args['footer_date'] ) {
|
||||
$classes[] = '_no-footer-date';
|
||||
}
|
||||
|
||||
if ( ! $args['footer_status'] ) {
|
||||
$classes[] = '_no-footer-status';
|
||||
}
|
||||
|
||||
if ( ! $args['footer_rating'] ) {
|
||||
$classes[] = '_no-footer-rating';
|
||||
}
|
||||
|
||||
// Meta
|
||||
$meta = [];
|
||||
|
||||
if ( $args['source'] ) {
|
||||
$meta['story'] = sprintf(
|
||||
_x(
|
||||
'<span class="post-list-item__meta-in-story"><span>in </span><a href="%1$s">%2$s</a></span>',
|
||||
'Story in Latest * shortcode (type: list).',
|
||||
'fictioneer'
|
||||
),
|
||||
get_the_permalink( $story_id ),
|
||||
$story['title']
|
||||
);
|
||||
}
|
||||
|
||||
if ( $words > 0 && $args['footer_words'] ) {
|
||||
$meta['words'] = '<span class="post-list-item__meta-words">' . sprintf(
|
||||
_x( '%s Words', 'Word count in Latest * shortcode (type: list).', 'fictioneer' ),
|
||||
number_format_i18n( $words )
|
||||
) . '</span>';
|
||||
}
|
||||
|
||||
if ( $args['footer_status'] ) {
|
||||
$meta['status'] = '<span class="post-item-item__meta-status">' . fcntr( $story['status'] ) . '</span>';
|
||||
}
|
||||
|
||||
if ( $chapter_rating && $args['footer_rating'] ) {
|
||||
$meta['rating'] = '<span class="post-list-item__meta-rating">' . fcntr( $chapter_rating ) . '</span>';
|
||||
}
|
||||
|
||||
if ( get_option( 'fictioneer_show_authors' ) && $args['footer_author'] ) {
|
||||
$author = fictioneer_get_author_node( null, 'post-list-item__meta-author' );
|
||||
|
||||
if ( $author ) {
|
||||
$meta['author'] = $author;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $args['footer_date'] ) {
|
||||
$meta['publish_date'] = '<span class="post-list-item__meta-publish-date _floating-right">' . get_the_date( $args['date_format'], $post ) . '</span>';
|
||||
}
|
||||
|
||||
$meta = apply_filters( 'fictioneer_filter_shortcode_latest_chapter_list_meta', $meta, $post, $story );
|
||||
|
||||
// Attributes
|
||||
$attributes = [];
|
||||
|
||||
if ( $args['aspect_ratio'] ) {
|
||||
$attributes['style'] = '--post-item-image-aspect-ratio: ' . $args['aspect_ratio'];
|
||||
}
|
||||
|
||||
$attributes = apply_filters( 'fictioneer_filter_shortcode_list_attributes', $attributes, $post, 'latest-chapters' );
|
||||
|
||||
$output_attributes = '';
|
||||
|
||||
foreach ( $attributes as $key => $value ) {
|
||||
$output_attributes .= esc_attr( $key ) . '="' . esc_attr( $value ) . '" ';
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<li class="post-<?php echo $post_id; ?> post-list-item _latest-chapters <?php echo implode( ' ', $classes ); ?>" <?php echo $output_attributes; ?>>
|
||||
|
||||
<?php
|
||||
if ( $thumbnail ) {
|
||||
echo $thumbnail;
|
||||
}
|
||||
?>
|
||||
|
||||
<a href="<?php echo $permalink; ?>" class="post-list-item__title _link"><?php
|
||||
$html_title = empty( $post->post_password ) ? '' : '<i class="fa-solid fa-lock protected-icon"></i> ';
|
||||
$html_title .= $title;
|
||||
|
||||
echo apply_filters( 'fictioneer_filter_shortcode_list_title', $html_title, $post, 'shortcode-latest-chapters-list' );
|
||||
?></a>
|
||||
|
||||
<?php if ( $args['footer'] ) : ?>
|
||||
<div class="post-list-item__meta _pseudo-separator"><?php echo implode( ' ', $meta ); ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
</li>
|
||||
|
||||
<?php endwhile; ?>
|
||||
</ul>
|
||||
|
||||
<?php else : ?>
|
||||
|
||||
<div class="no-results"><?php _e( 'Nothing to show.', 'fictioneer' ); ?></div>
|
||||
|
||||
<?php endif; wp_reset_postdata(); ?>
|
||||
</section>
|
@ -8,35 +8,38 @@
|
||||
* @subpackage Fictioneer
|
||||
* @since 4.0.0
|
||||
*
|
||||
* @internal $args['type'] Type argument passed from shortcode. Default 'default'.
|
||||
* @internal $args['count'] Number of posts provided by the shortcode.
|
||||
* @internal $args['author'] Author provided by the shortcode.
|
||||
* @internal $args['order'] Order of posts. Default 'DESC'.
|
||||
* @internal $args['orderby'] Sorting of posts. Default 'date'.
|
||||
* @internal $args['spoiler'] Whether to obscure or show chapter excerpt.
|
||||
* @internal $args['post_ids'] Array of post IDs. Default empty.
|
||||
* @internal $args['author_ids'] Array of author IDs. Default empty.
|
||||
* @internal $args['excluded_authors'] Array of author IDs to exclude. Default empty.
|
||||
* @internal $args['excluded_cats'] Array of category IDs to exclude. Default empty.
|
||||
* @internal $args['excluded_tags'] Array of tag IDs to exclude. Default empty.
|
||||
* @internal $args['ignore_protected'] Whether to ignore protected posts. Default false.
|
||||
* @internal $args['taxonomies'] Array of taxonomy arrays. Default empty.
|
||||
* @internal $args['relation'] Relationship between taxonomies.
|
||||
* @internal $args['spoiler'] Whether to obscure or show chapter excerpt.
|
||||
* @internal $args['source'] Whether to show author and story.
|
||||
* @internal $args['simple'] Whether to show the simple variant.
|
||||
* @internal $args['vertical'] Whether to show the vertical variant.
|
||||
* @internal $args['seamless'] Whether to render the image seamless. Default false (Customizer).
|
||||
* @internal $args['aspect_ratio'] Aspect ratio for the image. Only with vertical.
|
||||
* @internal $args['lightbox'] Whether the image is opened in the lightbox. Default true.
|
||||
* @internal $args['thumbnail'] Whether the image is rendered. Default true (Customizer).
|
||||
* @internal $args['footer'] Whether to show the footer. Default true.
|
||||
* @internal $args['footer_words'] Whether to show the chapter word count. Default true.
|
||||
* @internal $args['footer_date'] Whether to show the chapter date. Default true.
|
||||
* @internal $args['footer_comments'] Whether to show the chapter comment count. Default true.
|
||||
* @internal $args['footer_status'] Whether to show the chapter story status. Default true.
|
||||
* @internal $args['footer_rating'] Whether to show the chapter age rating. Default true.
|
||||
* @internal $args['classes'] String of additional CSS classes. Default empty.
|
||||
* @internal $args['type'] Type argument passed from shortcode. Default 'default'.
|
||||
* @internal $args['count'] Number of posts provided by the shortcode.
|
||||
* @internal $args['author'] Author provided by the shortcode.
|
||||
* @internal $args['order'] Order of posts. Default 'DESC'.
|
||||
* @internal $args['orderby'] Sorting of posts. Default 'date'.
|
||||
* @internal $args['spoiler'] Whether to obscure or show chapter excerpt.
|
||||
* @internal $args['post_ids'] Array of post IDs. Default empty.
|
||||
* @internal $args['author_ids'] Array of author IDs. Default empty.
|
||||
* @internal $args['excluded_authors'] Array of author IDs to exclude. Default empty.
|
||||
* @internal $args['excluded_cats'] Array of category IDs to exclude. Default empty.
|
||||
* @internal $args['excluded_tags'] Array of tag IDs to exclude. Default empty.
|
||||
* @internal $args['ignore_protected'] Whether to ignore protected posts. Default false.
|
||||
* @internal $args['taxonomies'] Array of taxonomy arrays. Default empty.
|
||||
* @internal $args['relation'] Relationship between taxonomies.
|
||||
* @internal $args['spoiler'] Whether to obscure or show chapter excerpt.
|
||||
* @internal $args['source'] Whether to show author and story.
|
||||
* @internal $args['simple'] Whether to show the simple variant.
|
||||
* @internal $args['vertical'] Whether to show the vertical variant.
|
||||
* @internal $args['seamless'] Whether to render the image seamless. Default false (Customizer).
|
||||
* @internal $args['aspect_ratio'] Aspect ratio for the image. Only with vertical.
|
||||
* @internal $args['lightbox'] Whether the image is opened in the lightbox. Default true.
|
||||
* @internal $args['thumbnail'] Whether the image is rendered. Default true (Customizer).
|
||||
* @internal $args['date_format'] String to override the date format. Default empty.
|
||||
* @internal $args['nested_date_format'] String to override the date format of nested items. Default empty.
|
||||
* @internal $args['footer'] Whether to show the footer. Default true.
|
||||
* @internal $args['footer_author'] Whether to show the chapter author. Default true.
|
||||
* @internal $args['footer_words'] Whether to show the chapter word count. Default true.
|
||||
* @internal $args['footer_date'] Whether to show the chapter date. Default true.
|
||||
* @internal $args['footer_comments'] Whether to show the chapter comment count. Default true.
|
||||
* @internal $args['footer_status'] Whether to show the chapter story status. Default true.
|
||||
* @internal $args['footer_rating'] Whether to show the chapter age rating. Default true.
|
||||
* @internal $args['classes'] String of additional CSS classes. Default empty.
|
||||
*/
|
||||
|
||||
|
||||
@ -248,7 +251,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
|
||||
<div class="card__content _small cell-desc">
|
||||
<div class="truncate <?php echo $truncate_factor; ?> <?php if ( ! $args['spoiler'] ) echo '_obfuscated'; ?>" data-obfuscation-target>
|
||||
<?php if ( get_option( 'fictioneer_show_authors' ) && $args['source'] ) : ?>
|
||||
<?php if ( get_option( 'fictioneer_show_authors' ) && $args['source'] && $args['footer_author'] ) : ?>
|
||||
<span class="card__by-author"><?php
|
||||
printf( _x( 'by %s', 'Small card: by {Author}.', 'fictioneer' ), fictioneer_get_author_node() );
|
||||
?></span>
|
||||
@ -307,10 +310,12 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
}
|
||||
|
||||
if ( $args['footer_date'] ) {
|
||||
$format = $args['date_format'] ?: FICTIONEER_LATEST_CHAPTERS_FOOTER_DATE;
|
||||
|
||||
if ( $args['orderby'] === 'modified' ) {
|
||||
$footer_items['modified_date'] = '<span class="card__footer-modified-date"><i class="card-footer-icon fa-regular fa-clock" title="' . esc_attr__( 'Last Updated', 'fictioneer' ) . '"></i> ' . get_the_modified_date( FICTIONEER_LATEST_CHAPTERS_FOOTER_DATE, $post ) . '</span>';
|
||||
$footer_items['modified_date'] = '<span class="card__footer-modified-date"><i class="card-footer-icon fa-regular fa-clock" title="' . esc_attr__( 'Last Updated', 'fictioneer' ) . '"></i> ' . get_the_modified_date( $format, $post ) . '</span>';
|
||||
} else {
|
||||
$footer_items['publish_date'] = '<span class="card__footer-publish-date"><i class="card-footer-icon fa-solid fa-clock" title="' . esc_attr__( 'Published', 'fictioneer' ) . '"></i> ' . get_the_date( FICTIONEER_LATEST_CHAPTERS_FOOTER_DATE, $post ) . '</span>';
|
||||
$footer_items['publish_date'] = '<span class="card__footer-publish-date"><i class="card-footer-icon fa-solid fa-clock" title="' . esc_attr__( 'Published', 'fictioneer' ) . '"></i> ' . get_the_date( $format, $post ) . '</span>';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
* @internal $args['ignore_protected'] Whether to ignore protected posts. Default false.
|
||||
* @internal $args['taxonomies'] Array of taxonomy arrays. Default empty.
|
||||
* @internal $args['relation'] Relationship between taxonomies.
|
||||
* @internal $args['source'] Whether to show author and story.
|
||||
* @internal $args['source'] Whether to show the author. Default true.
|
||||
* @internal $args['vertical'] Whether to show the vertical variant.
|
||||
* @internal $args['seamless'] Whether to render the image seamless. Default false (Customizer).
|
||||
* @internal $args['aspect_ratio'] Aspect ratio for the image. Only with vertical.
|
||||
@ -320,10 +320,12 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
}
|
||||
|
||||
if ( $args['footer_date'] ) {
|
||||
$format = $args['date_format'] ?: FICTIONEER_LATEST_STORIES_FOOTER_DATE;
|
||||
|
||||
if ( $args['orderby'] === 'modified' ) {
|
||||
$footer_items['modified_date'] = '<span class="card__footer-modified-date"><i class="card-footer-icon fa-regular fa-clock" title="' . esc_attr__( 'Last Updated', 'fictioneer' ) . '"></i> ' . get_the_modified_date( FICTIONEER_LATEST_STORIES_FOOTER_DATE, $post ) . '</span>';
|
||||
$footer_items['modified_date'] = '<span class="card__footer-modified-date"><i class="card-footer-icon fa-regular fa-clock" title="' . esc_attr__( 'Last Updated', 'fictioneer' ) . '"></i> ' . get_the_modified_date( $format, $post ) . '</span>';
|
||||
} else {
|
||||
$footer_items['publish_date'] = '<span class="card__footer-publish-date"><i class="card-footer-icon fa-solid fa-clock" title="' . esc_attr__( 'Published', 'fictioneer' ) . '"></i> ' . get_the_date( FICTIONEER_LATEST_STORIES_FOOTER_DATE, $post ) . '</span>';
|
||||
$footer_items['publish_date'] = '<span class="card__footer-publish-date"><i class="card-footer-icon fa-solid fa-clock" title="' . esc_attr__( 'Published', 'fictioneer' ) . '"></i> ' . get_the_date( $format, $post ) . '</span>';
|
||||
}
|
||||
}
|
||||
|
||||
|
324
partials/_latest-stories-list.php
Normal file
324
partials/_latest-stories-list.php
Normal file
@ -0,0 +1,324 @@
|
||||
<?php
|
||||
/**
|
||||
* Partial: Latest Stories List
|
||||
*
|
||||
* Renders the (buffered) HTML for the [fictioneer_latest_stories type="list"] shortcode.
|
||||
*
|
||||
* @package WordPress
|
||||
* @subpackage Fictioneer
|
||||
* @since 5.23.0
|
||||
* @see fictioneer_clause_sticky_stories()
|
||||
*
|
||||
* @internal $args['type'] Type argument passed from shortcode.
|
||||
* @internal $args['count'] Number of posts provided by the shortcode.
|
||||
* @internal $args['author'] Author provided by the shortcode.
|
||||
* @internal $args['order'] Order of posts. Default 'DESC'.
|
||||
* @internal $args['orderby'] Sorting of posts. Default 'date'.
|
||||
* @internal $args['post_ids'] Array of post IDs. Default empty.
|
||||
* @internal $args['author_ids'] Array of author IDs. Default empty.
|
||||
* @internal $args['excluded_authors'] Array of author IDs to exclude. Default empty.
|
||||
* @internal $args['excluded_cats'] Array of category IDs to exclude. Default empty.
|
||||
* @internal $args['excluded_tags'] Array of tag IDs to exclude. Default empty.
|
||||
* @internal $args['ignore_protected'] Whether to ignore protected posts. Default false.
|
||||
* @internal $args['taxonomies'] Array of taxonomy arrays. Default empty.
|
||||
* @internal $args['relation'] Relationship between taxonomies.
|
||||
* @internal $args['source'] Whether to show author and story. Default true.
|
||||
* @internal $args['vertical'] Whether to show the vertical variant.
|
||||
* @internal $args['seamless'] Whether to render the image seamless. Default false (Customizer).
|
||||
* @internal $args['aspect_ratio'] Aspect ratio for the image. Only with vertical.
|
||||
* @internal $args['lightbox'] Whether the image is opened in the lightbox. Default true.
|
||||
* @internal $args['thumbnail'] Whether the image is rendered. Default true (Customizer).
|
||||
* @internal $args['terms'] Either inline, pills, none, or false. Default inline.
|
||||
* @internal $args['max_terms'] Maximum number of shown taxonomies. Default 10.
|
||||
* @internal $args['date_format'] String to override the date format. Default empty.
|
||||
* @internal $args['footer'] Whether to show the footer. Default true.
|
||||
* @internal $args['footer_author'] Whether to show the story author. Default true.
|
||||
* @internal $args['footer_words'] Whether to show the story word count. Default true.
|
||||
* @internal $args['footer_date'] Whether to show the story date. Default true.
|
||||
* @internal $args['footer_status'] Whether to show the story status. Default true.
|
||||
* @internal $args['footer_rating'] Whether to show the story age rating. Default true.
|
||||
* @internal $args['classes'] String of additional CSS classes. Default empty.
|
||||
*/
|
||||
|
||||
|
||||
// No direct access!
|
||||
defined( 'ABSPATH' ) OR exit;
|
||||
|
||||
// Setup
|
||||
$show_terms = ! in_array( $args['terms'], ['none', 'false'] );
|
||||
$content_list_style = get_theme_mod( 'content_list_style', 'default' );
|
||||
|
||||
// Prepare query
|
||||
$query_args = array(
|
||||
'fictioneer_query_name' => 'latest_stories_list',
|
||||
'post_type' => 'fcn_story',
|
||||
'post_status' => 'publish',
|
||||
'post__in' => $args['post_ids'], // May be empty!
|
||||
'order' => $args['order'],
|
||||
'orderby' => $args['orderby'],
|
||||
'posts_per_page' => $args['count'],
|
||||
'update_post_term_cache' => $show_terms, // Improve performance
|
||||
'no_found_rows' => true
|
||||
);
|
||||
|
||||
// Use extended meta query?
|
||||
if ( get_option( 'fictioneer_disable_extended_story_list_meta_queries' ) ) {
|
||||
$query_args['meta_key'] = 'fictioneer_story_hidden';
|
||||
$query_args['meta_value'] = '0';
|
||||
} else {
|
||||
$query_args['meta_query'] = array(
|
||||
'relation' => 'OR',
|
||||
array(
|
||||
'key' => 'fictioneer_story_hidden',
|
||||
'value' => '0'
|
||||
),
|
||||
array(
|
||||
'key' => 'fictioneer_story_hidden',
|
||||
'compare' => 'NOT EXISTS'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Author?
|
||||
if ( ! empty( $args['author'] ) ) {
|
||||
$query_args['author_name'] = $args['author'];
|
||||
}
|
||||
|
||||
// Author IDs?
|
||||
if ( ! empty( $args['author_ids'] ) ) {
|
||||
$query_args['author__in'] = $args['author_ids'];
|
||||
}
|
||||
|
||||
// Taxonomies?
|
||||
if ( ! empty( $args['taxonomies'] ) ) {
|
||||
$query_args['tax_query'] = fictioneer_get_shortcode_tax_query( $args );
|
||||
}
|
||||
|
||||
// Excluded tags?
|
||||
if ( ! empty( $args['excluded_tags'] ) ) {
|
||||
$query_args['tag__not_in'] = $args['excluded_tags'];
|
||||
}
|
||||
|
||||
// Excluded categories?
|
||||
if ( ! empty( $args['excluded_cats'] ) ) {
|
||||
$query_args['category__not_in'] = $args['excluded_cats'];
|
||||
}
|
||||
|
||||
// Excluded authors?
|
||||
if ( ! empty( $args['excluded_authors'] ) ) {
|
||||
$query_args['author__not_in'] = $args['excluded_authors'];
|
||||
}
|
||||
|
||||
// Ignore protected?
|
||||
if ( $args['ignore_protected'] ) {
|
||||
add_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
}
|
||||
|
||||
// Apply filters
|
||||
$query_args = apply_filters( 'fictioneer_filter_shortcode_latest_stories_query_args', $query_args, $args );
|
||||
|
||||
// Query stories
|
||||
$entries = fictioneer_shortcode_query( $query_args );
|
||||
|
||||
// Remove temporary filters
|
||||
remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
|
||||
?>
|
||||
|
||||
<section class="latest-stories _list <?php echo $args['classes']; ?>">
|
||||
<?php if ( $entries->have_posts() ) : ?>
|
||||
|
||||
<ul class="post-list _latest-stories">
|
||||
<?php while ( $entries->have_posts() ) : $entries->the_post(); ?>
|
||||
|
||||
<?php
|
||||
// Setup
|
||||
$post_id = $post->ID;
|
||||
$story = fictioneer_get_story_data( $post_id, false ); // Does not refresh comment count!
|
||||
$permalink = get_post_meta( $post_id, 'fictioneer_story_redirect_link', true ) ?: get_permalink( $post_id );
|
||||
$tags = get_option( 'fictioneer_show_tags_on_story_cards' ) ? get_the_tags( $post ) : false;
|
||||
$is_sticky = FICTIONEER_ENABLE_STICKY_CARDS && get_post_meta( $post_id, 'fictioneer_story_sticky', true );
|
||||
|
||||
// Thumbnail
|
||||
$thumbnail = null;
|
||||
|
||||
if ( $args['thumbnail'] ) {
|
||||
$thumbnail = fictioneer_render_thumbnail(
|
||||
array(
|
||||
'post_id' => $post_id,
|
||||
'title' => $story['title'],
|
||||
'permalink' => $permalink,
|
||||
'size' => 'snippet',
|
||||
'classes' => 'post-list-item__image',
|
||||
'lightbox' => $args['lightbox'],
|
||||
'aspect_ratio' => $args['aspect_ratio'] ?? '2/2.5'
|
||||
),
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
// Extra classes
|
||||
$classes = [];
|
||||
|
||||
if ( $is_sticky ) {
|
||||
$classes[] = '_sticky';
|
||||
}
|
||||
|
||||
if ( ! empty( $post->post_password ) ) {
|
||||
$classes[] = '_password';
|
||||
}
|
||||
|
||||
if ( $args['seamless'] ) {
|
||||
$classes[] = '_seamless';
|
||||
}
|
||||
|
||||
if ( $content_list_style !== 'default' ) {
|
||||
$classes[] = "_{$content_list_style}";
|
||||
}
|
||||
|
||||
if ( ! $thumbnail ) {
|
||||
$classes[] = '_no-thumbnail';
|
||||
}
|
||||
|
||||
if ( ! $show_terms || ! ( $story['has_taxonomies'] || $tags ) ) {
|
||||
$classes[] = '_no-tax';
|
||||
}
|
||||
|
||||
if ( ! $args['footer'] ) {
|
||||
$classes[] = '_no-footer';
|
||||
}
|
||||
|
||||
if ( ! $args['footer_author'] && ! $args['source'] ) {
|
||||
$classes[] = '_no-footer-author';
|
||||
}
|
||||
|
||||
if ( ! $args['footer_words'] ) {
|
||||
$classes[] = '_no-footer-words';
|
||||
}
|
||||
|
||||
if ( ! $args['footer_date'] ) {
|
||||
$classes[] = '_no-footer-date';
|
||||
}
|
||||
|
||||
if ( ! $args['footer_status'] ) {
|
||||
$classes[] = '_no-footer-status';
|
||||
}
|
||||
|
||||
if ( ! $args['footer_rating'] ) {
|
||||
$classes[] = '_no-footer-rating';
|
||||
}
|
||||
|
||||
// Meta
|
||||
$meta = [];
|
||||
|
||||
if ( $story['word_count'] > 0 && $args['footer_words'] ) {
|
||||
$meta['words'] = '<span class="post-item-item__meta-words">' . sprintf(
|
||||
_x( '%s Words', 'Word count in Latest * shortcode (type: list).', 'fictioneer' ),
|
||||
number_format_i18n( $story['word_count'] )
|
||||
) . '</span>';
|
||||
}
|
||||
|
||||
if ( $args['footer_status'] ) {
|
||||
$meta['status'] = '<span class="post-item-item__meta-status">' . fcntr( $story['status'] ) . '</span>';
|
||||
}
|
||||
|
||||
if ( $story['rating'] && $args['footer_rating'] ) {
|
||||
$meta['rating'] = '<span class="post-item-item__meta-rating">' . fcntr( $story['rating'] ) . '</span>';
|
||||
}
|
||||
|
||||
if ( get_option( 'fictioneer_show_authors' ) && $args['footer_author'] && $args['source'] ) {
|
||||
$author = fictioneer_get_author_node( $post->post_author, 'post-item-item__meta-author' );
|
||||
|
||||
if ( $author ) {
|
||||
$meta['author'] = $author;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $args['footer_date'] ) {
|
||||
$meta['publish_date'] = '<span class="post-item-item__meta-publish-date _floating-right">' . get_the_date( $args['date_format'], $post ) . '</span>';
|
||||
}
|
||||
|
||||
$meta = apply_filters( 'fictioneer_filter_shortcode_latest_stories_list_meta', $meta, $post, $story );
|
||||
|
||||
// Attributes
|
||||
$attributes = [];
|
||||
|
||||
if ( $args['aspect_ratio'] ) {
|
||||
$attributes['style'] = '--post-item-image-aspect-ratio: ' . $args['aspect_ratio'];
|
||||
}
|
||||
|
||||
$attributes = apply_filters( 'fictioneer_filter_shortcode_list_attributes', $attributes, $post, 'latest-stories' );
|
||||
|
||||
$output_attributes = '';
|
||||
|
||||
foreach ( $attributes as $key => $value ) {
|
||||
$output_attributes .= esc_attr( $key ) . '="' . esc_attr( $value ) . '" ';
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<li class="post-<?php echo $post_id; ?> post-list-item _latest-stories <?php echo implode( ' ', $classes ); ?>" <?php echo $output_attributes; ?>>
|
||||
|
||||
<?php
|
||||
if ( $thumbnail ) {
|
||||
echo $thumbnail;
|
||||
}
|
||||
?>
|
||||
|
||||
<a href="<?php echo $permalink; ?>" class="post-list-item__title _link"><?php
|
||||
$html_title = empty( $post->post_password ) ? '' : '<i class="fa-solid fa-lock protected-icon"></i> ';
|
||||
$html_title .= $story['title'];
|
||||
|
||||
echo apply_filters( 'fictioneer_filter_shortcode_list_title', $story['title'], $post, 'shortcode-latest-updates-list' );
|
||||
?></a>
|
||||
|
||||
<?php if ( $args['footer'] ) : ?>
|
||||
<div class="post-list-item__meta _pseudo-separator"><?php echo implode( ' ', $meta ); ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $show_terms && ( $story['has_taxonomies'] || $tags ) ) : ?>
|
||||
<div class="post-list-item__tax <?php echo $args['terms'] === 'inline' ? '_pseudo-separator' : '_pills'; ?>"><?php
|
||||
$inline = $args['terms'] === 'pills' ? '' : '_inline';
|
||||
$terms = [];
|
||||
|
||||
if ( $story['fandoms'] ) {
|
||||
foreach ( $story['fandoms'] as $fandom ) {
|
||||
$terms[ $fandom->term_id ] = '<a href="' . get_tag_link( $fandom ) . '" class="tag-pill ' . $inline . ' _fandom">' . $fandom->name . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $story['genres'] ) {
|
||||
foreach ( $story['genres'] as $genre ) {
|
||||
$terms[ $genre->term_id ] = '<a href="' . get_tag_link( $genre ) . '" class="tag-pill ' . $inline . ' _genre">' . $genre->name . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $tags ) {
|
||||
foreach ( $tags as $tag ) {
|
||||
$terms[ $tag->term_id ] = '<a href="' . get_tag_link( $tag ) . '" class="tag-pill ' . $inline . '">' . $tag->name . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $story['characters'] ) {
|
||||
foreach ( $story['characters'] as $character ) {
|
||||
$terms[ $character->term_id ] = '<a href="' . get_tag_link( $character ) . '" class="tag-pill ' . $inline . ' _character">' . $character->name . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
$terms = apply_filters( 'fictioneer_filter_shortcode_latest_stories_terms', $terms, $story, $args );
|
||||
|
||||
echo implode( ' ', array_slice( $terms, 0, $args['max_terms'] ) );
|
||||
?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
</li>
|
||||
|
||||
<?php endwhile; ?>
|
||||
</ul>
|
||||
|
||||
<?php else : ?>
|
||||
|
||||
<div class="no-results"><?php _e( 'Nothing to show.', 'fictioneer' ); ?></div>
|
||||
|
||||
<?php endif; wp_reset_postdata(); ?>
|
||||
</section>
|
@ -9,32 +9,33 @@
|
||||
* @since 4.0.0
|
||||
* @see fictioneer_clause_sticky_stories()
|
||||
*
|
||||
* @internal $args['type'] Type argument passed from shortcode.
|
||||
* @internal $args['count'] Number of posts provided by the shortcode.
|
||||
* @internal $args['author'] Author provided by the shortcode.
|
||||
* @internal $args['order'] Order of posts. Default 'DESC'.
|
||||
* @internal $args['orderby'] Sorting of posts. Default 'date'.
|
||||
* @internal $args['post_ids'] Array of post IDs. Default empty.
|
||||
* @internal $args['author_ids'] Array of author IDs. Default empty.
|
||||
* @internal $args['excluded_authors'] Array of author IDs to exclude. Default empty.
|
||||
* @internal $args['excluded_cats'] Array of category IDs to exclude. Default empty.
|
||||
* @internal $args['excluded_tags'] Array of tag IDs to exclude. Default empty.
|
||||
* @internal $args['ignore_protected'] Whether to ignore protected posts. Default false.
|
||||
* @internal $args['taxonomies'] Array of taxonomy arrays. Default empty.
|
||||
* @internal $args['relation'] Relationship between taxonomies.
|
||||
* @internal $args['source'] Whether to show author and story. Default true.
|
||||
* @internal $args['vertical'] Whether to show the vertical variant.
|
||||
* @internal $args['seamless'] Whether to render the image seamless. Default false (Customizer).
|
||||
* @internal $args['aspect_ratio'] Aspect ratio for the image. Only with vertical.
|
||||
* @internal $args['lightbox'] Whether the image is opened in the lightbox. Default true.
|
||||
* @internal $args['thumbnail'] Whether the image is rendered. Default true (Customizer).
|
||||
* @internal $args['footer'] Whether to show the footer. Default true.
|
||||
* @internal $args['footer_chapters'] Whether to show the chapter count. Default true.
|
||||
* @internal $args['footer_words'] Whether to show the word count. Default true.
|
||||
* @internal $args['footer_date'] Whether to show the date. Default true.
|
||||
* @internal $args['footer_status'] Whether to show the status. Default true.
|
||||
* @internal $args['footer_rating'] Whether to show the age rating. Default true.
|
||||
* @internal $args['classes'] String of additional CSS classes. Default empty.
|
||||
* @internal $args['type'] Type argument passed from shortcode.
|
||||
* @internal $args['count'] Number of posts provided by the shortcode.
|
||||
* @internal $args['author'] Author provided by the shortcode.
|
||||
* @internal $args['order'] Order of posts. Default 'DESC'.
|
||||
* @internal $args['orderby'] Sorting of posts. Default 'date'.
|
||||
* @internal $args['post_ids'] Array of post IDs. Default empty.
|
||||
* @internal $args['author_ids'] Array of author IDs. Default empty.
|
||||
* @internal $args['excluded_authors'] Array of author IDs to exclude. Default empty.
|
||||
* @internal $args['excluded_cats'] Array of category IDs to exclude. Default empty.
|
||||
* @internal $args['excluded_tags'] Array of tag IDs to exclude. Default empty.
|
||||
* @internal $args['ignore_protected'] Whether to ignore protected posts. Default false.
|
||||
* @internal $args['taxonomies'] Array of taxonomy arrays. Default empty.
|
||||
* @internal $args['relation'] Relationship between taxonomies.
|
||||
* @internal $args['source'] Whether to show the author. Default true.
|
||||
* @internal $args['vertical'] Whether to show the vertical variant.
|
||||
* @internal $args['seamless'] Whether to render the image seamless. Default false (Customizer).
|
||||
* @internal $args['aspect_ratio'] Aspect ratio for the image. Only with vertical.
|
||||
* @internal $args['lightbox'] Whether the image is opened in the lightbox. Default true.
|
||||
* @internal $args['thumbnail'] Whether the image is rendered. Default true (Customizer).
|
||||
* @internal $args['footer'] Whether to show the footer. Default true.
|
||||
* @internal $args['date_format'] String to override the date format. Default empty.
|
||||
* @internal $args['footer_chapters'] Whether to show the chapter count. Default true.
|
||||
* @internal $args['footer_words'] Whether to show the word count. Default true.
|
||||
* @internal $args['footer_date'] Whether to show the date. Default true.
|
||||
* @internal $args['footer_status'] Whether to show the status. Default true.
|
||||
* @internal $args['footer_rating'] Whether to show the age rating. Default true.
|
||||
* @internal $args['classes'] String of additional CSS classes. Default empty.
|
||||
*/
|
||||
|
||||
|
||||
@ -302,10 +303,12 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
}
|
||||
|
||||
if ( $args['footer_date'] ) {
|
||||
$format = $args['date_format'] ?: FICTIONEER_LATEST_STORIES_FOOTER_DATE;
|
||||
|
||||
if ( $args['orderby'] === 'modified' ) {
|
||||
$footer_items['modified_date'] = '<span class="card__footer-modified-date"><i class="card-footer-icon fa-regular fa-clock" title="' . esc_attr__( 'Last Updated', 'fictioneer' ) . '"></i> ' . get_the_modified_date( FICTIONEER_LATEST_STORIES_FOOTER_DATE, $post ) . '</span>';
|
||||
$footer_items['modified_date'] = '<span class="card__footer-modified-date"><i class="card-footer-icon fa-regular fa-clock" title="' . esc_attr__( 'Last Updated', 'fictioneer' ) . '"></i> ' . get_the_modified_date( $format, $post ) . '</span>';
|
||||
} else {
|
||||
$footer_items['publish_date'] = '<span class="card__footer-publish-date"><i class="card-footer-icon fa-solid fa-clock" title="' . esc_attr__( 'Published', 'fictioneer' ) . '"></i> ' . get_the_date( FICTIONEER_LATEST_STORIES_FOOTER_DATE, $post ) . '</span>';
|
||||
$footer_items['publish_date'] = '<span class="card__footer-publish-date"><i class="card-footer-icon fa-solid fa-clock" title="' . esc_attr__( 'Published', 'fictioneer' ) . '"></i> ' . get_the_date( $format, $post ) . '</span>';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,34 +11,36 @@
|
||||
* @subpackage Fictioneer
|
||||
* @since 4.3.0
|
||||
*
|
||||
* @internal $args['type'] Type argument passed from shortcode ('compact').
|
||||
* @internal $args['single'] Whether to show only one chapter item. Default false.
|
||||
* @internal $args['count'] Number of posts provided by the shortcode.
|
||||
* @internal $args['author'] Author provided by the shortcode.
|
||||
* @internal $args['order'] Order of posts. Default 'DESC'.
|
||||
* @internal $args['post_ids'] Array of post IDs. Default empty.
|
||||
* @internal $args['author_ids'] Array of author IDs. Default empty.
|
||||
* @internal $args['excluded_authors'] Array of author IDs to exclude. Default empty.
|
||||
* @internal $args['excluded_cats'] Array of category IDs to exclude. Default empty.
|
||||
* @internal $args['excluded_tags'] Array of tag IDs to exclude. Default empty.
|
||||
* @internal $args['ignore_protected'] Whether to ignore protected posts. Default false.
|
||||
* @internal $args['taxonomies'] Array of taxonomy arrays. Default empty.
|
||||
* @internal $args['relation'] Relationship between taxonomies.
|
||||
* @internal $args['source'] Whether to show author and story.
|
||||
* @internal $args['vertical'] Whether to show the vertical variant.
|
||||
* @internal $args['seamless'] Whether to render the image seamless. Default false (Customizer).
|
||||
* @internal $args['aspect_ratio'] Aspect ratio for the image. Only with vertical.
|
||||
* @internal $args['lightbox'] Whether the image is opened in the lightbox. Default true.
|
||||
* @internal $args['thumbnail'] Whether the image is rendered. Default true (Customizer).
|
||||
* @internal $args['words'] Whether to show the word count of chapter items. Default true.
|
||||
* @internal $args['date'] Whether to show the date of chapter items. Default true.
|
||||
* @internal $args['footer_chapters'] Whether to show the story chapter count. Default true.
|
||||
* @internal $args['footer_words'] Whether to show the story word count. Default true.
|
||||
* @internal $args['footer_date'] Whether to show the modified date. Default true.
|
||||
* @internal $args['footer_status'] Whether to show the story status. Default true.
|
||||
* @internal $args['footer_rating'] Whether to show the story age rating. Default true.
|
||||
* @internal $args['classes'] String of additional CSS classes. Default empty.
|
||||
* @internal $args['infobox'] Whether to show the info box and toggle.
|
||||
* @internal $args['type'] Type argument passed from shortcode ('compact').
|
||||
* @internal $args['single'] Whether to show only one chapter item. Default false.
|
||||
* @internal $args['count'] Number of posts provided by the shortcode.
|
||||
* @internal $args['author'] Author provided by the shortcode.
|
||||
* @internal $args['order'] Order of posts. Default 'DESC'.
|
||||
* @internal $args['post_ids'] Array of post IDs. Default empty.
|
||||
* @internal $args['author_ids'] Array of author IDs. Default empty.
|
||||
* @internal $args['excluded_authors'] Array of author IDs to exclude. Default empty.
|
||||
* @internal $args['excluded_cats'] Array of category IDs to exclude. Default empty.
|
||||
* @internal $args['excluded_tags'] Array of tag IDs to exclude. Default empty.
|
||||
* @internal $args['ignore_protected'] Whether to ignore protected posts. Default false.
|
||||
* @internal $args['taxonomies'] Array of taxonomy arrays. Default empty.
|
||||
* @internal $args['relation'] Relationship between taxonomies.
|
||||
* @internal $args['source'] Whether to show author and story.
|
||||
* @internal $args['vertical'] Whether to show the vertical variant.
|
||||
* @internal $args['seamless'] Whether to render the image seamless. Default false (Customizer).
|
||||
* @internal $args['aspect_ratio'] Aspect ratio for the image. Only with vertical.
|
||||
* @internal $args['lightbox'] Whether the image is opened in the lightbox. Default true.
|
||||
* @internal $args['thumbnail'] Whether the image is rendered. Default true (Customizer).
|
||||
* @internal $args['words'] Whether to show the word count of chapter items. Default true.
|
||||
* @internal $args['date'] Whether to show the date of chapter items. Default true.
|
||||
* @internal $args['date_format'] String to override the date format. Default empty.
|
||||
* @internal $args['nested_date_format'] String to override the date format of nested items. Default empty.
|
||||
* @internal $args['footer_chapters'] Whether to show the story chapter count. Default true.
|
||||
* @internal $args['footer_words'] Whether to show the story word count. Default true.
|
||||
* @internal $args['footer_date'] Whether to show the modified date. Default true.
|
||||
* @internal $args['footer_status'] Whether to show the story status. Default true.
|
||||
* @internal $args['footer_rating'] Whether to show the story age rating. Default true.
|
||||
* @internal $args['classes'] String of additional CSS classes. Default empty.
|
||||
* @internal $args['infobox'] Whether to show the info box and toggle.
|
||||
*/
|
||||
|
||||
|
||||
@ -321,8 +323,9 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
}
|
||||
|
||||
if ( $args['date'] ) {
|
||||
echo '<span class="date">' .
|
||||
get_the_date( FICTIONEER_LATEST_UPDATES_LI_DATE, $chapter->ID ) . '</span>';
|
||||
echo '<span class="date">' . get_the_date(
|
||||
$args['nested_date_format'] ?: FICTIONEER_LATEST_UPDATES_LI_DATE, $chapter->ID
|
||||
) . '</span>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
360
partials/_latest-updates-list.php
Normal file
360
partials/_latest-updates-list.php
Normal file
@ -0,0 +1,360 @@
|
||||
<?php
|
||||
/**
|
||||
* Partial: Latest Updates List
|
||||
*
|
||||
* Renders the (buffered) HTML for the [fictioneer_latest_updates type="list"]
|
||||
* shortcode. Looks for the 'fictioneer_chapters_added' meta property and only
|
||||
* updates when the items in the chapters list increase. Admittedly, this can
|
||||
* be exploited by removing and re-adding chapters.
|
||||
*
|
||||
* @package WordPress
|
||||
* @subpackage Fictioneer
|
||||
* @since 5.23.0
|
||||
*
|
||||
* @internal $args['type'] Type argument passed from shortcode. Default 'default'.
|
||||
* @internal $args['single'] Whether to show only one chapter item. Default false.
|
||||
* @internal $args['count'] Number of posts provided by the shortcode.
|
||||
* @internal $args['author'] Author provided by the shortcode.
|
||||
* @internal $args['order'] Order of posts. Default 'DESC'.
|
||||
* @internal $args['post_ids'] Array of post IDs. Default empty.
|
||||
* @internal $args['author_ids'] Array of author IDs. Default empty.
|
||||
* @internal $args['excluded_authors'] Array of author IDs to exclude. Default empty.
|
||||
* @internal $args['excluded_cats'] Array of category IDs to exclude. Default empty.
|
||||
* @internal $args['excluded_tags'] Array of tag IDs to exclude. Default empty.
|
||||
* @internal $args['ignore_protected'] Whether to ignore protected posts. Default false.
|
||||
* @internal $args['taxonomies'] Array of taxonomy arrays. Default empty.
|
||||
* @internal $args['relation'] Relationship between taxonomies.
|
||||
* @internal $args['source'] Whether to show author and story.
|
||||
* @internal $args['vertical'] Whether to show the vertical variant.
|
||||
* @internal $args['seamless'] Whether to render the image seamless. Default false (Customizer).
|
||||
* @internal $args['aspect_ratio'] Aspect ratio for the image. Only with vertical.
|
||||
* @internal $args['lightbox'] Whether the image is opened in the lightbox. Default true.
|
||||
* @internal $args['thumbnail'] Whether the image is rendered. Default true (Customizer).
|
||||
* @internal $args['words'] Whether to show the word count of chapter items. Default true.
|
||||
* @internal $args['date'] Whether to show the date of chapter items. Default true.
|
||||
* @internal $args['terms'] Either inline, pills, none, or false. Default inline.
|
||||
* @internal $args['max_terms'] Maximum number of shown taxonomies. Default 10.
|
||||
* @internal $args['date_format'] String to override the date format. Default empty.
|
||||
* @internal $args['nested_date_format'] String to override the date format of nested items. Default empty.
|
||||
* @internal $args['footer'] Whether to show the footer. Default true.
|
||||
* @internal $args['footer_author'] Whether to show the chapter author. Default true.
|
||||
* @internal $args['footer_words'] Whether to show the chapter word count. Default true.
|
||||
* @internal $args['footer_date'] Whether to show the chapter date. Default true.
|
||||
* @internal $args['footer_rating'] Whether to show the story/chapter age rating. Default true.
|
||||
* @internal $args['classes'] String of additional CSS classes. Default empty.
|
||||
*/
|
||||
|
||||
|
||||
// No direct access!
|
||||
defined( 'ABSPATH' ) OR exit;
|
||||
|
||||
// Setup
|
||||
$render_count = 0;
|
||||
$show_terms = ! in_array( $args['terms'], ['none', 'false'] );
|
||||
$content_list_style = get_theme_mod( 'content_list_style', 'default' );
|
||||
|
||||
// Prepare query
|
||||
$query_args = array(
|
||||
'fictioneer_query_name' => 'latest_updates_list',
|
||||
'post_type' => 'fcn_story',
|
||||
'post_status' => 'publish',
|
||||
'post__in' => $args['post_ids'], // May be empty!
|
||||
'order' => $args['order'],
|
||||
'orderby' => 'meta_value',
|
||||
'meta_key' => 'fictioneer_chapters_added',
|
||||
'posts_per_page' => $args['count'] + 4, // Account for non-eligible posts!
|
||||
'update_post_term_cache' => $show_terms, // Improve performance
|
||||
'no_found_rows' => true // Improve performance
|
||||
);
|
||||
|
||||
// Use extended meta query?
|
||||
if ( get_option( 'fictioneer_disable_extended_story_list_meta_queries' ) ) {
|
||||
// Extended syntax necessary due to 'fictioneer_chapters_added'
|
||||
$query_args['meta_query'] = array(
|
||||
array(
|
||||
'key' => 'fictioneer_story_hidden',
|
||||
'value' => '0'
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$query_args['meta_query'] = array(
|
||||
'relation' => 'OR',
|
||||
array(
|
||||
'key' => 'fictioneer_story_hidden',
|
||||
'value' => '0'
|
||||
),
|
||||
array(
|
||||
'key' => 'fictioneer_story_hidden',
|
||||
'compare' => 'NOT EXISTS'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Author?
|
||||
if ( ! empty( $args['author'] ) ) {
|
||||
$query_args['author_name'] = $args['author'];
|
||||
}
|
||||
|
||||
// Author IDs?
|
||||
if ( ! empty( $args['author_ids'] ) ) {
|
||||
$query_args['author__in'] = $args['author_ids'];
|
||||
}
|
||||
|
||||
// Taxonomies?
|
||||
if ( ! empty( $args['taxonomies'] ) ) {
|
||||
$query_args['tax_query'] = fictioneer_get_shortcode_tax_query( $args );
|
||||
}
|
||||
|
||||
// Excluded tags?
|
||||
if ( ! empty( $args['excluded_tags'] ) ) {
|
||||
$query_args['tag__not_in'] = $args['excluded_tags'];
|
||||
}
|
||||
|
||||
// Excluded categories?
|
||||
if ( ! empty( $args['excluded_cats'] ) ) {
|
||||
$query_args['category__not_in'] = $args['excluded_cats'];
|
||||
}
|
||||
|
||||
// Excluded authors?
|
||||
if ( ! empty( $args['excluded_authors'] ) ) {
|
||||
$query_args['author__not_in'] = $args['excluded_authors'];
|
||||
}
|
||||
|
||||
// Ignore protected?
|
||||
if ( $args['ignore_protected'] ) {
|
||||
add_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
}
|
||||
|
||||
// Apply filters
|
||||
$query_args = apply_filters( 'fictioneer_filter_shortcode_latest_updates_query_args', $query_args, $args );
|
||||
|
||||
// Query stories
|
||||
$entries = fictioneer_shortcode_query( $query_args );
|
||||
|
||||
// Remove temporary filters
|
||||
remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
|
||||
?>
|
||||
|
||||
<section class="latest-updates _list <?php echo $args['classes']; ?>">
|
||||
<?php if ( $entries->have_posts() ) : ?>
|
||||
|
||||
<ul class="post-list _latest-updates">
|
||||
<?php while ( $entries->have_posts() ) : $entries->the_post(); ?>
|
||||
|
||||
<?php
|
||||
// Setup
|
||||
$post_id = $post->ID;
|
||||
$story = fictioneer_get_story_data( $post_id, false ); // Does not refresh comment count!
|
||||
$permalink = get_post_meta( $post_id, 'fictioneer_story_redirect_link', true ) ?: get_permalink( $post_id );
|
||||
$tags = get_option( 'fictioneer_show_tags_on_story_cards' ) ? get_the_tags( $post ) : false;
|
||||
$chapter_list = [];
|
||||
|
||||
// Skip if no chapters
|
||||
if ( $story['chapter_count'] < 1 ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Count actually rendered items to account for buffer
|
||||
if ( ++$render_count > $args['count'] ) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Thumbnail
|
||||
$thumbnail = null;
|
||||
|
||||
if ( $args['thumbnail'] ) {
|
||||
$thumbnail = fictioneer_render_thumbnail(
|
||||
array(
|
||||
'post_id' => $post_id,
|
||||
'title' => $story['title'],
|
||||
'permalink' => $permalink,
|
||||
'size' => 'snippet',
|
||||
'classes' => 'post-list-item__image',
|
||||
'lightbox' => $args['lightbox'],
|
||||
'aspect_ratio' => $args['aspect_ratio'] ?? '2/2.5'
|
||||
),
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
// Extra classes
|
||||
$classes = [];
|
||||
|
||||
if ( ! empty( $post->post_password ) ) {
|
||||
$classes[] = '_password';
|
||||
}
|
||||
|
||||
if ( $args['seamless'] ) {
|
||||
$classes[] = '_seamless';
|
||||
}
|
||||
|
||||
if ( $content_list_style !== 'default' ) {
|
||||
$classes[] = "_{$content_list_style}";
|
||||
}
|
||||
|
||||
if ( ! $thumbnail ) {
|
||||
$classes[] = '_no-thumbnail';
|
||||
}
|
||||
|
||||
if ( ! $show_terms || ! ( $story['has_taxonomies'] || $tags ) ) {
|
||||
$classes[] = '_no-tax';
|
||||
}
|
||||
|
||||
if ( ! $args['footer'] ) {
|
||||
$classes[] = '_no-footer';
|
||||
}
|
||||
|
||||
if ( ! $args['footer_author'] ) {
|
||||
$classes[] = '_no-footer-author';
|
||||
}
|
||||
|
||||
if ( ! $args['words'] || ! $args['footer_words'] ) {
|
||||
$classes[] = '_no-chapter-words';
|
||||
}
|
||||
|
||||
if ( ! $args['date'] || ! $args['footer_date'] ) {
|
||||
$classes[] = '_no-chapter-dates';
|
||||
}
|
||||
|
||||
if ( ! $args['footer_rating'] ) {
|
||||
$classes[] = '_no-footer-rating';
|
||||
}
|
||||
|
||||
// Search for viable chapters...
|
||||
$search_list = array_reverse( $story['chapter_ids'] );
|
||||
$chapter_post = null;
|
||||
|
||||
foreach ( $search_list as $chapter_id ) {
|
||||
$chapter_post = get_post( $chapter_id );
|
||||
|
||||
if ( ! $chapter_post || get_post_meta( $chapter_id, 'fictioneer_chapter_hidden', true ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( $args['ignore_protected'] && $chapter_post->post_password ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// No viable chapter
|
||||
if ( ! $chapter_post ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Meta
|
||||
$meta = [];
|
||||
|
||||
$meta['chapter'] = '<a href="' . get_the_permalink( $chapter_post ) . '" class="post-list-item__meta-chapter"><i class="fa-solid fa-caret-right chapter-link-icon"></i> ' . fictioneer_get_safe_title( $chapter_post, 'shortcode-latest-updates-list-chapter' ) . '</a>';
|
||||
|
||||
if ( $args['words'] && $args['footer_words'] ) {
|
||||
$meta['words'] = '<span class="post-item-item__meta-words">' . sprintf(
|
||||
_x( '%s Words', 'Word count in Latest * shortcode (type: list).', 'fictioneer' ),
|
||||
number_format_i18n( fictioneer_get_word_count( $chapter_post->ID ) )
|
||||
) . '</span>';
|
||||
}
|
||||
|
||||
if ( $story['rating'] && $args['footer_rating'] ) {
|
||||
$meta['rating'] = '<span class="post-item-item__meta-rating">' . fcntr( $story['rating'] ) . '</span>';
|
||||
}
|
||||
|
||||
if ( get_option( 'fictioneer_show_authors' ) && $args['footer_author'] ) {
|
||||
$author = fictioneer_get_author_node( $chapter_post->post_author, 'post-item-item__meta-author' );
|
||||
|
||||
if ( $author ) {
|
||||
$meta['author'] = $author;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $args['date'] && $args['footer_date'] ) {
|
||||
$format = $args['date_format'] ?: $args['nested_date_format'] ?: '';
|
||||
|
||||
$meta['date'] = '<span class="post-item-item__meta-publish-date _floating-right">' . get_the_date( $format, $chapter_post->ID ) . '</span>';
|
||||
}
|
||||
|
||||
$meta = apply_filters( 'fictioneer_filter_shortcode_latest_updates_list_meta', $meta, $post, $story, $chapter_post );
|
||||
|
||||
// Attributes
|
||||
$attributes = [];
|
||||
|
||||
if ( $args['aspect_ratio'] ) {
|
||||
$attributes['style'] = '--post-item-image-aspect-ratio: ' . $args['aspect_ratio'];
|
||||
}
|
||||
|
||||
$attributes = apply_filters( 'fictioneer_filter_shortcode_list_attributes', $attributes, $post, 'latest-updates' );
|
||||
|
||||
$output_attributes = '';
|
||||
|
||||
foreach ( $attributes as $key => $value ) {
|
||||
$output_attributes .= esc_attr( $key ) . '="' . esc_attr( $value ) . '" ';
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<li class="post-<?php echo $post_id; ?> post-list-item _latest-updates <?php echo implode( ' ', $classes ); ?>" <?php echo $output_attributes; ?>>
|
||||
|
||||
<?php
|
||||
if ( $thumbnail ) {
|
||||
echo $thumbnail;
|
||||
}
|
||||
?>
|
||||
|
||||
<a href="<?php echo $permalink; ?>" class="post-list-item__title _link"><?php
|
||||
$html_title = empty( $post->post_password ) ? '' : '<i class="fa-solid fa-lock protected-icon"></i> ';
|
||||
$html_title .= $story['title'];
|
||||
|
||||
echo apply_filters( 'fictioneer_filter_shortcode_list_title', $story['title'], $post, 'shortcode-latest-updates-list' );
|
||||
?></a>
|
||||
|
||||
<?php if ( $args['footer'] ) : ?>
|
||||
<div class="post-list-item__meta _pseudo-separator"><?php echo implode( ' ', $meta ); ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $show_terms && ( $story['has_taxonomies'] || $tags ) ) : ?>
|
||||
<div class="post-list-item__tax <?php echo $args['terms'] === 'inline' ? '_pseudo-separator' : '_pills'; ?>"><?php
|
||||
$inline = $args['terms'] === 'pills' ? '' : '_inline';
|
||||
$terms = [];
|
||||
|
||||
if ( $story['fandoms'] ) {
|
||||
foreach ( $story['fandoms'] as $fandom ) {
|
||||
$terms[ $fandom->term_id ] = '<a href="' . get_tag_link( $fandom ) . '" class="tag-pill ' . $inline . ' _fandom">' . $fandom->name . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $story['genres'] ) {
|
||||
foreach ( $story['genres'] as $genre ) {
|
||||
$terms[ $genre->term_id ] = '<a href="' . get_tag_link( $genre ) . '" class="tag-pill ' . $inline . ' _genre">' . $genre->name . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $tags ) {
|
||||
foreach ( $tags as $tag ) {
|
||||
$terms[ $tag->term_id ] = '<a href="' . get_tag_link( $tag ) . '" class="tag-pill ' . $inline . '">' . $tag->name . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $story['characters'] ) {
|
||||
foreach ( $story['characters'] as $character ) {
|
||||
$terms[ $character->term_id ] = '<a href="' . get_tag_link( $character ) . '" class="tag-pill ' . $inline . ' _character">' . $character->name . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
$terms = apply_filters( 'fictioneer_filter_shortcode_latest_updates_terms', $terms, $story, $args );
|
||||
|
||||
echo implode( ' ', array_slice( $terms, 0, $args['max_terms'] ) );
|
||||
?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
</li>
|
||||
|
||||
<?php endwhile; ?>
|
||||
</ul>
|
||||
|
||||
<?php else : ?>
|
||||
|
||||
<div class="no-results"><?php _e( 'Nothing to show.', 'fictioneer' ); ?></div>
|
||||
|
||||
<?php endif; wp_reset_postdata(); ?>
|
||||
</section>
|
@ -12,34 +12,38 @@
|
||||
* @subpackage Fictioneer
|
||||
* @since 4.3.0
|
||||
*
|
||||
* @internal $args['type'] Type argument passed from shortcode. Default 'default'.
|
||||
* @internal $args['single'] Whether to show only one chapter item. Default false.
|
||||
* @internal $args['count'] Number of posts provided by the shortcode.
|
||||
* @internal $args['author'] Author provided by the shortcode.
|
||||
* @internal $args['order'] Order of posts. Default 'DESC'.
|
||||
* @internal $args['post_ids'] Array of post IDs. Default empty.
|
||||
* @internal $args['author_ids'] Array of author IDs. Default empty.
|
||||
* @internal $args['excluded_authors'] Array of author IDs to exclude. Default empty.
|
||||
* @internal $args['excluded_cats'] Array of category IDs to exclude. Default empty.
|
||||
* @internal $args['excluded_tags'] Array of tag IDs to exclude. Default empty.
|
||||
* @internal $args['ignore_protected'] Whether to ignore protected posts. Default false.
|
||||
* @internal $args['taxonomies'] Array of taxonomy arrays. Default empty.
|
||||
* @internal $args['relation'] Relationship between taxonomies.
|
||||
* @internal $args['source'] Whether to show author and story.
|
||||
* @internal $args['vertical'] Whether to show the vertical variant.
|
||||
* @internal $args['seamless'] Whether to render the image seamless. Default false (Customizer).
|
||||
* @internal $args['aspect_ratio'] Aspect ratio for the image. Only with vertical.
|
||||
* @internal $args['lightbox'] Whether the image is opened in the lightbox. Default true.
|
||||
* @internal $args['thumbnail'] Whether the image is rendered. Default true (Customizer).
|
||||
* @internal $args['words'] Whether to show the word count of chapter items. Default true.
|
||||
* @internal $args['date'] Whether to show the date of chapter items. Default true.
|
||||
* @internal $args['footer'] Whether to show the footer. Default true.
|
||||
* @internal $args['footer_chapters'] Whether to show the story chapter count. Default true.
|
||||
* @internal $args['footer_words'] Whether to show the story word count. Default true.
|
||||
* @internal $args['footer_date'] Whether to show the modified date. Default true.
|
||||
* @internal $args['footer_status'] Whether to show the story status. Default true.
|
||||
* @internal $args['footer_rating'] Whether to show the story age rating. Default true.
|
||||
* @internal $args['classes'] String of additional CSS classes. Default empty.
|
||||
* @internal $args['type'] Type argument passed from shortcode. Default 'default'.
|
||||
* @internal $args['single'] Whether to show only one chapter item. Default false.
|
||||
* @internal $args['count'] Number of posts provided by the shortcode.
|
||||
* @internal $args['author'] Author provided by the shortcode.
|
||||
* @internal $args['order'] Order of posts. Default 'DESC'.
|
||||
* @internal $args['post_ids'] Array of post IDs. Default empty.
|
||||
* @internal $args['author_ids'] Array of author IDs. Default empty.
|
||||
* @internal $args['excluded_authors'] Array of author IDs to exclude. Default empty.
|
||||
* @internal $args['excluded_cats'] Array of category IDs to exclude. Default empty.
|
||||
* @internal $args['excluded_tags'] Array of tag IDs to exclude. Default empty.
|
||||
* @internal $args['ignore_protected'] Whether to ignore protected posts. Default false.
|
||||
* @internal $args['taxonomies'] Array of taxonomy arrays. Default empty.
|
||||
* @internal $args['relation'] Relationship between taxonomies.
|
||||
* @internal $args['source'] Whether to show author and story.
|
||||
* @internal $args['vertical'] Whether to show the vertical variant.
|
||||
* @internal $args['seamless'] Whether to render the image seamless. Default false (Customizer).
|
||||
* @internal $args['aspect_ratio'] Aspect ratio for the image. Only with vertical.
|
||||
* @internal $args['lightbox'] Whether the image is opened in the lightbox. Default true.
|
||||
* @internal $args['thumbnail'] Whether the image is rendered. Default true (Customizer).
|
||||
* @internal $args['words'] Whether to show the word count of chapter items. Default true.
|
||||
* @internal $args['date'] Whether to show the date of chapter items. Default true.
|
||||
* @internal $args['terms'] Either inline, pills, none, or false. Default inline.
|
||||
* @internal $args['max_terms'] Maximum number of taxonomies terms. Default 10.
|
||||
* @internal $args['date_format'] String to override the date format. Default empty.
|
||||
* @internal $args['nested_date_format'] String to override the date format of nested items. Default empty.
|
||||
* @internal $args['footer'] Whether to show the footer. Default true.
|
||||
* @internal $args['footer_chapters'] Whether to show the story chapter count. Default true.
|
||||
* @internal $args['footer_words'] Whether to show the story word count. Default true.
|
||||
* @internal $args['footer_date'] Whether to show the modified date. Default true.
|
||||
* @internal $args['footer_status'] Whether to show the story status. Default true.
|
||||
* @internal $args['footer_rating'] Whether to show the story age rating. Default true.
|
||||
* @internal $args['classes'] String of additional CSS classes. Default empty.
|
||||
*/
|
||||
|
||||
|
||||
@ -48,7 +52,9 @@ defined( 'ABSPATH' ) OR exit;
|
||||
|
||||
// Setup
|
||||
$card_counter = 0;
|
||||
$show_tags = ! get_option( 'fictioneer_hide_taxonomies_on_story_cards' ) && ! in_array( $args['type'], ['simple', 'single'] );
|
||||
$show_terms = ! get_option( 'fictioneer_hide_taxonomies_on_story_cards' ) &&
|
||||
! in_array( $args['type'], ['simple', 'single'] ) &&
|
||||
! in_array( $args['terms'], ['none', 'false'] );
|
||||
|
||||
// Prepare query
|
||||
$query_args = array(
|
||||
@ -60,7 +66,7 @@ $query_args = array(
|
||||
'orderby' => 'meta_value',
|
||||
'meta_key' => 'fictioneer_chapters_added',
|
||||
'posts_per_page' => $args['count'] + 4, // Account for non-eligible posts!
|
||||
'update_post_term_cache' => $show_tags, // Improve performance
|
||||
'update_post_term_cache' => $show_terms, // Improve performance
|
||||
'no_found_rows' => true // Improve performance
|
||||
);
|
||||
|
||||
@ -351,8 +357,9 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
}
|
||||
|
||||
if ( $args['date'] ) {
|
||||
echo '<span class="date">' .
|
||||
get_the_date( FICTIONEER_LATEST_UPDATES_LI_DATE, $chapter->ID ) . '</span>';
|
||||
echo '<span class="date">' . get_the_date(
|
||||
$args['nested_date_format'] ?: FICTIONEER_LATEST_UPDATES_LI_DATE, $chapter->ID
|
||||
) . '</span>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
@ -361,39 +368,41 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
<?php endforeach; ?>
|
||||
</ol>
|
||||
|
||||
<?php if ( $show_tags ) : ?>
|
||||
<?php if ( $show_terms ) : ?>
|
||||
<div class="card__tag-list _small _scrolling cell-tax">
|
||||
<div class="card__h-scroll">
|
||||
<?php
|
||||
if ( $story['has_taxonomies'] || $tags ) {
|
||||
$output = [];
|
||||
$terms = [];
|
||||
|
||||
if ( $story['fandoms'] ) {
|
||||
foreach ( $story['fandoms'] as $fandom ) {
|
||||
$output[] = '<a href="' . get_tag_link( $fandom ) . '" class="tag-pill _inline _fandom">' . $fandom->name . '</a>';
|
||||
$terms[ $fandom->term_id ] = '<a href="' . get_tag_link( $fandom ) . '" class="tag-pill _inline _fandom">' . $fandom->name . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $story['genres'] ) {
|
||||
foreach ( $story['genres'] as $genre ) {
|
||||
$output[] = '<a href="' . get_tag_link( $genre ) . '" class="tag-pill _inline _genre">' . $genre->name . '</a>';
|
||||
$terms[ $genre->term_id ] = '<a href="' . get_tag_link( $genre ) . '" class="tag-pill _inline _genre">' . $genre->name . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $tags ) {
|
||||
foreach ( $tags as $tag ) {
|
||||
$output[] = '<a href="' . get_tag_link( $tag ) . '" class="tag-pill _inline">' . $tag->name . '</a>';
|
||||
$terms[ $tag->term_id ] = '<a href="' . get_tag_link( $tag ) . '" class="tag-pill _inline">' . $tag->name . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $story['characters'] ) {
|
||||
foreach ( $story['characters'] as $character ) {
|
||||
$output[] = '<a href="' . get_tag_link( $character ) . '" class="tag-pill _inline _character">' . $character->name . '</a>';
|
||||
$terms[ $character->term_id ] = '<a href="' . get_tag_link( $character ) . '" class="tag-pill _inline _character">' . $character->name . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
$terms = apply_filters( 'fictioneer_filter_shortcode_latest_updates_terms', $terms, $story, $args );
|
||||
|
||||
// Implode with three-per-em spaces around a bullet
|
||||
echo implode( ' • ', $output );
|
||||
echo implode( ' • ', $terms );
|
||||
} else {
|
||||
?><span class="card__no-taxonomies"><?php _e( 'No taxonomies specified yet.', 'fictioneer' ); ?></span><?php
|
||||
}
|
||||
@ -419,7 +428,9 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
}
|
||||
|
||||
if ( $args['footer_date'] ) {
|
||||
$footer_items['modified_date'] = '<span class="card__footer-modified-date"><i class="card-footer-icon fa-regular fa-clock" title="' . esc_attr__( 'Last Updated', 'fictioneer' ) . '"></i> ' . get_the_modified_date( FICTIONEER_LATEST_UPDATES_FOOTER_DATE, $post ) . '</span>';
|
||||
$format = $args['date_format'] ?: FICTIONEER_LATEST_UPDATES_FOOTER_DATE;
|
||||
|
||||
$footer_items['modified_date'] = '<span class="card__footer-modified-date"><i class="card-footer-icon fa-regular fa-clock" title="' . esc_attr__( 'Last Updated', 'fictioneer' ) . '"></i> ' . get_the_modified_date( $format, $post ) . '</span>';
|
||||
}
|
||||
|
||||
if ( $args['footer_status'] ) {
|
||||
|
@ -422,9 +422,9 @@
|
||||
|
||||
.card__right {
|
||||
flex: 0 0 auto;
|
||||
color: var(--fg-800);
|
||||
font-size: var(--card-list-right-font-size, clamp(12px + var(--card-font-size-min-mod, 0px), 2.5cqw + var(--card-font-size-grow-mod, 0px), 13.5px + var(--card-font-size-max-mod, 0px)));
|
||||
line-height: 1.55;
|
||||
opacity: .5;
|
||||
|
||||
&._flex {
|
||||
display: flex;
|
||||
|
@ -668,7 +668,7 @@ html:not(.logged-in) body:not(.logged-in) {
|
||||
&__list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--chapter-list-gap, 4px);
|
||||
gap: var(--chapter-list-gap, var(--content-list-gap, 4px));
|
||||
font-size: var(--fs-xs);
|
||||
padding: 4px; // Space for small shadows due to overflow: hidden
|
||||
margin: -4px; // Space for small shadows due to overflow: hidden
|
||||
|
@ -10,6 +10,7 @@
|
||||
@import 'comments';
|
||||
@import 'fonts-full';
|
||||
@import 'collections';
|
||||
@import 'post-list';
|
||||
|
||||
@import '_reader-settings';
|
||||
@import '_suggestions';
|
||||
|
@ -6,7 +6,7 @@
|
||||
--card-content-li-background: none;
|
||||
--story-blog-li-background: none;
|
||||
--chapter-li-background: none;
|
||||
--chapter-li-padding-bottom-offset: var(--chapter-list-gap, 4px);
|
||||
--chapter-li-padding-bottom-offset: var(--chapter-list-gap, var(--content-list-gap, 4px));
|
||||
|
||||
:is(.chapter-group__list-item, .story__blog-list-item, .card__link-list-item) {
|
||||
border-radius: 0;
|
||||
|
219
src/scss/post-list.scss
Normal file
219
src/scss/post-list.scss
Normal file
@ -0,0 +1,219 @@
|
||||
.post-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--post-list-gap, var(--content-list-gap, 4px));
|
||||
container-type: inline-size;
|
||||
}
|
||||
|
||||
.post-list-item {
|
||||
position: relative;
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr;
|
||||
grid-template-areas:
|
||||
'img ts'
|
||||
'img title'
|
||||
'img meta'
|
||||
'img bs';
|
||||
background: var(--post-list-li-background, var(--content-li-background));
|
||||
line-height: 1.3;
|
||||
padding: .5rem 8px .5rem 0;
|
||||
border-radius: var(--layout-border-radius-small);
|
||||
|
||||
&:is(._latest-updates, ._latest-stories):not(._no-tax) {
|
||||
grid-template-areas:
|
||||
'img ts'
|
||||
'img title'
|
||||
'img meta'
|
||||
'img tax'
|
||||
'img bs';
|
||||
}
|
||||
|
||||
&._no-footer {
|
||||
grid-template-areas:
|
||||
'img ts'
|
||||
'img title'
|
||||
'img bs';
|
||||
}
|
||||
|
||||
&._no-footer:is(._latest-updates, ._latest-stories):not(._no-tax) {
|
||||
grid-template-areas:
|
||||
'img ts'
|
||||
'img title'
|
||||
'img tax'
|
||||
'img bs';
|
||||
}
|
||||
|
||||
&._seamless {
|
||||
grid-template-rows: .5rem auto auto .5rem;
|
||||
padding: 0 8px 0 0;
|
||||
|
||||
.post-list-item__image {
|
||||
height: 100%;
|
||||
width: 3rem;
|
||||
|
||||
img {
|
||||
--layout-nested-border-radius-multiplier: 1;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
&:is(._latest-updates, ._latest-stories):not(._no-tax) {
|
||||
grid-template-rows: .5rem auto auto auto .5rem;
|
||||
}
|
||||
|
||||
&._full {
|
||||
.post-list-item__image {
|
||||
img {
|
||||
border-top-right-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&._no-footer-date .post-list-item__title {
|
||||
padding-right: 0;
|
||||
}
|
||||
|
||||
&._no-thumbnail {
|
||||
padding-left: 2px;
|
||||
}
|
||||
|
||||
&._full {
|
||||
&:not(._seamless) {
|
||||
padding-left: 8px;
|
||||
}
|
||||
|
||||
&._seamless._no-thumbnail {
|
||||
padding-left: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
&._lines {
|
||||
&:not(:last-child) {
|
||||
border-bottom: var(--content-li-hr-border);
|
||||
padding-bottom: calc(.5rem + var(--post-list-gap, var(--content-list-gap, 4px)));
|
||||
|
||||
&._seamless {
|
||||
padding-bottom: var(--post-list-gap, var(--content-list-gap, 4px));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&__image {
|
||||
grid-area: img;
|
||||
align-self: center;
|
||||
margin-right: .75rem;
|
||||
width: 2.5rem;
|
||||
|
||||
&[data-lightbox] {
|
||||
cursor: zoom-in;
|
||||
}
|
||||
|
||||
img {
|
||||
aspect-ratio: var(--post-item-image-aspect-ratio, 2 / 2.5);
|
||||
display: block;
|
||||
border-radius: calc(var(--layout-border-radius-small) * var(--layout-nested-border-radius-multiplier, 1));
|
||||
height: auto;
|
||||
width: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
}
|
||||
|
||||
&__title {
|
||||
grid-area: title;
|
||||
color: var(--post-list-title-color, var(--heading-link-color));
|
||||
font-family: var(--ff-post-list-title, var(--ff-heading));
|
||||
font-weight: var(--font-weight-medium);
|
||||
font-size: get_clamp(13, 14, 320, 768); // Fallback
|
||||
font-size: var(--post-list-title-font-size, clamp(13px, 4.1cqw, 14px));
|
||||
margin-right: 128px;
|
||||
width: fit-content;
|
||||
|
||||
.protected-icon {
|
||||
font-size: .8em;
|
||||
margin-right: .125em;
|
||||
opacity: .9;
|
||||
transform: translateY(-0.125em);
|
||||
}
|
||||
|
||||
@container (max-width: 639px) {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&__meta,
|
||||
&__tax {
|
||||
grid-area: meta;
|
||||
color: var(--post-list-meta-color, var(--fg-600));
|
||||
font-family: var(--ff-post-list-meta, var(--ff-note));
|
||||
font-size: var(--post-list-meta-font-size, 13px); // Fallback
|
||||
font-size: var(--post-list-meta-font-size, clamp(12px, 3.5cqw, 13px));
|
||||
line-height: 1.5;
|
||||
margin-top: 4px;
|
||||
|
||||
a:hover {
|
||||
--layout-link-color-hover: var(--post-list-meta-link-color-hover, var(--fg-200));
|
||||
}
|
||||
}
|
||||
|
||||
&__meta {
|
||||
.chapter-link-icon {
|
||||
color: var(--fg-800);
|
||||
line-height: inherit;
|
||||
margin-right: 0.25em;
|
||||
}
|
||||
|
||||
&-chapter,
|
||||
&-in-story {
|
||||
display: block;
|
||||
margin-bottom: 3px;
|
||||
|
||||
@container (min-width: 550px) {
|
||||
display: inline;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&__tax {
|
||||
grid-area: tax;
|
||||
margin-top: 6px;
|
||||
|
||||
&._pills {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.tag-pill._inline {
|
||||
font-size: inherit;
|
||||
}
|
||||
}
|
||||
|
||||
._pseudo-separator > *:where(:not(:first-child))::before {
|
||||
content: var(--post-list-separator, '• ');
|
||||
color: var(--post-list-meta-divider-color, var(--fg-800));
|
||||
font-family: var(--ff-base);
|
||||
margin: 0 .125em;
|
||||
}
|
||||
|
||||
:where(._floating-right) {
|
||||
position: absolute;
|
||||
top: .5rem;
|
||||
right: 8px;
|
||||
opacity: .5;
|
||||
|
||||
&::before {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@container (max-width: 639px) {
|
||||
position: static;
|
||||
opacity: 1;
|
||||
|
||||
&::before {
|
||||
display: inline;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user