Add action hooks to shortcode card bodies

This commit is contained in:
Tetrakern 2024-01-28 00:42:09 +01:00
parent fe878126ec
commit 5fd686c054
9 changed files with 55 additions and 0 deletions

View File

@ -863,6 +863,45 @@ Fires right after opening the articles no-results `<section>` container in th
---
### `do_action( 'fictioneer_shortcode_latest_chapters_card_body', $post, $story_data, $args )`
Fires before the content of the small card grid is rendered in the `partials/_latest-chapters*.php` partials. 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 shortcode.
---
### `do_action( 'fictioneer_shortcode_latest_recommendations_card_body', $post, $args )`
Fires before the content of the small card grid is rendered in the `partials/_latest-recommendations*.php` partials. 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 shortcode.
---
### `do_action( 'fictioneer_shortcode_latest_stories_card_body', $post, $story_data, $args )`
Fires before the content of the small card grid is rendered in the `partials/_latest-stories*.php` partials. 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 shortcode.
---
### `do_action( 'fictioneer_shortcode_latest_updates_card_body', $post, $story_data, $args )`
Fires before the content of the small card grid is rendered in the `partials/_latest-updates*.php` partials. 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 shortcode.
---
### `do_action( 'fictioneer_site', $args )`
Fires right after opening the `#site` container in the `header.php` template. Includes the navigation bar and site header with background, logo, title, etc.

View File

@ -147,6 +147,8 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
<div class="card__main _grid _small">
<?php do_action( 'fictioneer_shortcode_latest_chapters_card_body', $post, $story, $args ); ?>
<?php if ( $thumbnail_full ) : ?>
<a href="<?php echo $thumbnail_full; ?>" title="<?php echo esc_attr( sprintf( __( '%s Thumbnail', 'fictioneer' ), $title ) ); ?>" class="card__image cell-img" <?php echo fictioneer_get_lightbox_attribute(); ?>><?php echo $thumbnail_snippet ?></a>
<?php elseif ( ! empty( $text_icon ) ) : ?>

View File

@ -147,6 +147,8 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
<div class="card__main _grid _small">
<?php do_action( 'fictioneer_shortcode_latest_chapters_card_body', $post, $story, $args ); ?>
<?php if ( $thumbnail_full ) : ?>
<a href="<?php echo $thumbnail_full; ?>" title="<?php echo esc_attr( sprintf( __( '%s Thumbnail', 'fictioneer' ), $title ) ); ?>" class="card__image cell-img" <?php echo fictioneer_get_lightbox_attribute(); ?>><?php echo $thumbnail_snippet ?></a>
<?php elseif ( ! empty( $text_icon ) ) : ?>

View File

@ -116,6 +116,8 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
<div class="card__main _grid _small">
<?php do_action( 'fictioneer_shortcode_latest_recommendations_card_body', $post, $args ); ?>
<?php if ( has_post_thumbnail() ) : ?>
<a href="<?php the_post_thumbnail_url( 'full' ); ?>" title="<?php echo esc_attr( sprintf( __( '%s Thumbnail', 'fictioneer' ), $title ) ); ?>" class="card__image cell-img" <?php echo fictioneer_get_lightbox_attribute(); ?>>
<?php echo get_the_post_thumbnail( $post, 'snippet', ['class' => 'no-auto-lightbox'] ); ?>

View File

@ -135,6 +135,8 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
<div class="card__main _grid _small">
<?php do_action( 'fictioneer_shortcode_latest_recommendations_card_body', $post, $args ); ?>
<?php if ( has_post_thumbnail() ) : ?>
<a href="<?php the_post_thumbnail_url( 'full' ); ?>" title="<?php echo esc_attr( sprintf( __( '%s Thumbnail', 'fictioneer' ), $title ) ); ?>" class="card__image cell-img" <?php echo fictioneer_get_lightbox_attribute(); ?>>
<?php echo get_the_post_thumbnail( $post, 'snippet', ['class' => 'no-auto-lightbox'] ); ?>

View File

@ -124,6 +124,8 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
<div class="card__main _grid _small">
<?php do_action( 'fictioneer_shortcode_latest_stories_card_body', $post, $story, $args ); ?>
<?php if ( has_post_thumbnail() ) : ?>
<a href="<?php the_post_thumbnail_url( 'full' ); ?>" title="<?php echo esc_attr( sprintf( __( '%s Thumbnail', 'fictioneer' ), $story['title'] ) ); ?>" class="card__image cell-img" <?php echo fictioneer_get_lightbox_attribute(); ?>>
<?php echo get_the_post_thumbnail( $post, 'snippet', ['class' => 'no-auto-lightbox'] ); ?>

View File

@ -117,6 +117,8 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
<div class="card__main _grid _small">
<?php do_action( 'fictioneer_shortcode_latest_stories_card_body', $post, $story, $args ); ?>
<?php if ( has_post_thumbnail() ) : ?>
<a href="<?php the_post_thumbnail_url( 'full' ); ?>" title="<?php echo esc_attr( sprintf( __( '%s Thumbnail', 'fictioneer' ), $story['title'] ) ); ?>" class="card__image cell-img" <?php echo fictioneer_get_lightbox_attribute(); ?>>
<?php echo get_the_post_thumbnail( $post, 'snippet', ['class' => 'no-auto-lightbox'] ); ?>

View File

@ -154,6 +154,8 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
<div class="card__main _grid _small">
<?php do_action( 'fictioneer_shortcode_latest_updates_card_body', $post, $story, $args ); ?>
<?php if ( has_post_thumbnail() ) : ?>
<a href="<?php the_post_thumbnail_url( 'full' ); ?>" title="<?php echo esc_attr( sprintf( __( '%s Thumbnail', 'fictioneer' ), $story['title'] ) ); ?>" class="card__image cell-img" <?php echo fictioneer_get_lightbox_attribute(); ?>><?php echo get_the_post_thumbnail( $post, 'snippet', ['class' => 'no-auto-lightbox'] ); ?></a>
<?php endif; ?>

View File

@ -155,6 +155,8 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
<div class="card__main _grid _small">
<?php do_action( 'fictioneer_shortcode_latest_updates_card_body', $post, $story, $args ); ?>
<?php if ( has_post_thumbnail() ) : ?>
<a href="<?php the_post_thumbnail_url( 'full' ); ?>" title="<?php echo esc_attr( sprintf( __( '%s Thumbnail', 'fictioneer' ), $story['title'] ) ); ?>" class="card__image cell-img" <?php echo fictioneer_get_lightbox_attribute(); ?>><?php echo get_the_post_thumbnail( $post, 'snippet', ['class' => 'no-auto-lightbox'] ); ?></a>
<?php endif; ?>