Rural Blog docsAll pages

Hooks and filters

All of these go in a child theme’s functions.php.

Actions

rural_blog_meta

Fires inside the meta row, after the categories, date and comment count — in a listing and on a single post.

The intended use is a custom field: reading time, a source, an ACF value.

add_action( 'rural_blog_meta', function () {
    $read = get_post_meta( get_the_ID(), 'reading_time', true );
    if ( $read ) {
        printf(
            '<span class="rural-blog-meta-item">%s</span>',
            esc_html( sprintf( '%s min read', $read ) )
        );
    }
} );

Wrap your output in .rural-blog-meta-item and it picks up the row’s spacing and meta typography.

Anything you print here counts toward whether the row is drawn at all: with all three built-in items switched off, the row still appears if your callback prints something.

Filters

rural_blog_header_classes

The class list on <header class="site-header">.

add_filter( 'rural_blog_header_classes', function ( $classes ) {
    if ( is_front_page() ) {
        $classes[] = 'header-home';
    }
    return $classes;
} );

The same for <footer class="site-footer">.

rural_blog_html_classes

Classes on the <html> element. Empty by default.

rural_blog_content_width

WordPress’s $content_width global. Default 750.

add_filter( 'rural_blog_content_width', fn() => 900 );

rural_blog_thumbnail_sizes

The sizes attribute printed on featured images, which the theme computes from the layout, display mode and grid column count.

add_filter( 'rural_blog_thumbnail_sizes', function ( $sizes, $layout, $display ) {
    return $sizes;
}, 10, 3 );

Only worth touching if you have changed the layout structurally in a child theme — the computed value is correct for the theme as shipped.

rural_blog_archives_index_args

The WP_Query arguments behind the Archives page template. Use it to include custom post types, or to cap the list on a very large site.

add_filter( 'rural_blog_archives_index_args', function ( $args ) {
    $args['post_type'] = array( 'post', 'note' );
    return $args;
} );

rural_blog_can_show_post_thumbnail

Whether a featured image may be printed at all. Default: not password-protected and not an attachment.

rural_blog_display_meta_category / rural_blog_display_meta_date

Both default true. A code-level switch for the category list and the date in the meta row, useful when the decision is conditional in a way the Customizer toggles cannot express.

add_filter( 'rural_blog_display_meta_date', fn( $show ) => ! is_page() && $show );

rural_blog_social_icons_map

Domain → icon. Extend it for a self-hosted Mastodon instance, or any service the theme does not know:

add_filter( 'rural_blog_social_icons_map', function ( $map ) {
    $map['mastodon'][] = 'social.example.org';
    return $map;
} );

rural_blog_svg_icons_social and rural_blog_svg_icons_{$group}

The SVG markup itself. {$group} is ui or social. Replace an icon, or add one to go with a new entry in the map above.

Replaceable functions

Beyond these hooks, every template tag in the theme is pluggable — wrapped in if ( ! function_exists() ). Define your own version in the child theme’s functions.php and the parent’s is skipped. See Override templates.

Core hooks

Everything WordPress provides works normally: wp_head, wp_footer, body_class, post_class, excerpt_length, excerpt_more, the_content, comment_form_defaults. The theme uses several of these itself, so check the priority you attach at if you are overriding one of its own callbacks.