Base child theme of Fictioneer for WordPress
Find a file
2024-04-08 18:40:17 +02:00
.github Create FUNDING.yml 2023-01-20 01:33:53 +01:00
css Initial commit 2023-01-20 01:32:29 +01:00
fonts Add folders 2024-02-08 01:16:47 +01:00
img Add folders 2024-02-08 01:16:47 +01:00
includes Add folders 2024-02-08 01:16:47 +01:00
js Initial commit 2023-01-20 01:32:29 +01:00
partials Add folders 2024-02-08 01:16:47 +01:00
.gitignore Initial commit 2023-01-20 01:32:29 +01:00
functions.php Update examples 2024-04-08 12:59:03 +02:00
LICENSE Initial commit 2023-01-20 01:32:29 +01:00
README.md Update README.md 2024-04-08 18:40:17 +02:00
style.css Tested up to 6.3.0 2023-08-28 00:47:26 +02:00

Fictioneer Child Theme

A blank WordPress child theme for Fictioneer.

Action & Filter Examples

You can modify the Fictioneer quite a lot with actions and filters. To keep things in one place as much as possible, most code snippets have been moved to the Fictioneer repository under Customize. You are expected to know the basics of CSS, HTML, and PHP or consult one of the many free tutorials on the matter just a quick Internet search away.

Example: Scope the Blog shortcode to specific roles

Put the following into your child theme functions.php.

function child_scope_blog_shortcode_to_roles( $query_args ) {
  # Optional: Only apply the filter to a specific page, etc.
  if ( ! is_page( 'your-page-slug' ) ) {
    return $query_args;
  }

  # Step 1: Get users with the specified role(s)
  $users = get_users( array( 'role__in' => ['author'] ) );

  # Step 2: Extract the user IDs
  $user_ids = wp_list_pluck( $users, 'ID' );

  # Step 3: Modify query arguments
  $query_args['author__in'] = $user_ids;

  # Step 4: Return modified query arguments
  return $query_args;
}
add_filter( 'fictioneer_filter_shortcode_blog_query_args', 'child_scope_blog_shortcode_to_roles', 10 );

Example: Removing Actions & Filters

In order to remove actions from the parent theme, best use the 'wp' (priority 11+) hook to ensure you remove them after they have been added (otherwise it will not work). Filters are similar, although some cases require more specific hooks, but 'init' or 'wp' should generally work too. More on removing actions and filters can be found in the official WordPress documentation.

/**
 * Example: Remove some actions and filters
 */

function child_remove_scheduled_chapter() {
  // Removes "Next Chapter" schedule note above chapter lists
  remove_action( 'fictioneer_story_after_content', 'fictioneer_story_scheduled_chapter', 41 );

  // Removes ellipsis added to "Read more" links on excerpts
  remove_filter( 'excerpt_more', 'fictioneer_excerpt_ellipsis' );
}
add_action( 'wp', 'child_remove_scheduled_chapter', 11 ); // This is added on 'wp' with priority 10, so you need to be later