Add action hooks to large card bodies

This commit is contained in:
Tetrakern 2024-01-27 22:32:10 +01:00
parent 8c91aad588
commit 2ca1f068bd
7 changed files with 75 additions and 0 deletions

View File

@ -586,6 +586,63 @@ Fires right after opening the inner `<header>` container. Normally includes a ba
---
### `do_action( 'fictioneer_large_card_body_chapter', $post, $story_data, $args )`
Fires before the content of the card grid is rendered in the `partials/_card-chapter.php` partial. Does not allow you to change the content of the body, but you can add additional HTML and use CSS to modify the look. If you want to change significantly the cards, better overwrite the partial.
**Parameters:**
* $post (WP_Post) Post object of the chapter.
* $story_data (array|null) Pre-processed data of the story. Unsafe.
* $args (array) Optional arguments passed to the card.
---
### `do_action( 'fictioneer_large_card_body_collection', $post, $items, $args )`
Fires before the content of the card grid is rendered in the `partials/_card-collection.php` partial. Does not allow you to change the content of the body, but you can add additional HTML and use CSS to modify the look. If you want to change significantly the cards, better overwrite the partial.
**Parameters:**
* $post (WP_Post) Post object of the collection.
* $items (array) Array of featured WP_Post objects.
* $args (array) Optional arguments passed to the card.
---
### `do_action( 'fictioneer_large_card_body_page', $post, $args )`
Fires before the content of the card grid is rendered in the `partials/_card-page.php` partial. Does not allow you to change the content of the body, but you can add additional HTML and use CSS to modify the look. If you want to change significantly the cards, better overwrite the partial.
**Parameters:**
* $post (WP_Post) Post object of the page.
* $args (array) Optional arguments passed to the card.
---
### `do_action( 'fictioneer_large_card_body_post', $post, $args )`
Fires before the content of the card grid is rendered in the `partials/_card-post.php` partial. Does not allow you to change the content of the body, but you can add additional HTML and use CSS to modify the look. If you want to change significantly the cards, better overwrite the partial.
**Parameters:**
* $post (WP_Post) Post object of the post.
* $args (array) Optional arguments passed to the card.
---
### `do_action( 'fictioneer_large_card_body_recommendation', $post, $args )`
Fires before the content of the card grid is rendered in the `partials/_card-recommendation.php` partial. Does not allow you to change the content of the body, but you can add additional HTML and use CSS to modify the look. If you want to change significantly the cards, better overwrite the partial.
**Parameters:**
* $post (WP_Post) Post object of the recommendation.
* $args (array) Optional arguments passed to the card.
---
### `do_action( 'fictioneer_large_card_body_story', $post, $story_data, $args )`
Fires before the content of the card grid is rendered in the `partials/_card-story.php` partial. Does not allow you to change the content of the body, but you can add additional HTML and use CSS to modify the look. If you want to change significantly the cards, better overwrite the partial.
**Parameters:**
* $post (WP_Post) Post object of the story.
* $story_data (array) Pre-processed data of the story.
* $args (array) Optional arguments passed to the card.
---
### `do_action( 'fictioneer_main' )`
Fires after opening the sites `<main>` container, right after the `.main-observer` element.

View File

@ -98,6 +98,9 @@ $show_taxonomies = ! get_option( 'fictioneer_hide_taxonomies_on_chapter_cards' )
<div class="card__main _grid _large">
<?php
// Action hook
do_action( 'fictioneer_large_card_body_chapter', $post, $story_data, $args );
// Thumbnail
if ( has_post_thumbnail() ) {

View File

@ -90,6 +90,9 @@ if ( empty( $description ) ) {
<div class="card__main _grid _large">
<?php
// Action hook
do_action( 'fictioneer_large_card_body_collection', $post, $items, $args );
// Thumbnail
if ( has_post_thumbnail() ) {
printf(

View File

@ -35,6 +35,9 @@ $comments_number = get_comments_number();
<div class="card__main _grid _large">
<?php
// Action hook
do_action( 'fictioneer_large_card_body_page', $post, $args );
// Thumbnail
if ( has_post_thumbnail() ) {
printf(

View File

@ -36,6 +36,9 @@ $categories = wp_get_post_categories( $post->ID );
<div class="card__main _grid _large">
<?php
// Action hook
do_action( 'fictioneer_large_card_body_post', $post, $args );
// Thumbnail
if ( has_post_thumbnail() ) {
printf(

View File

@ -64,6 +64,9 @@ $show_taxonomies = ! get_option( 'fictioneer_hide_taxonomies_on_recommendation_c
<div class="card__main _grid _large">
<?php
// Action hook
do_action( 'fictioneer_large_card_body_recommendation', $post, $args );
// Thumbnail
if ( has_post_thumbnail() ) {
printf(

View File

@ -75,6 +75,9 @@ $is_sticky = FICTIONEER_ENABLE_STICKY_CARDS &&
<div class="card__main _grid _large">
<?php
// Action hook
do_action( 'fictioneer_large_card_body_story', $post, $story, $args );
// Thumbnail
if ( has_post_thumbnail() ) {
printf(