Best way to distribute templates and code accross multiple wordpress sites?

You can bundle the files into a plugin. For the Christmas page, you could use the page_template filter – This question gives you an example on how to use it – Create custom page templates with plugins? For the CSS/JS file, you can add them using the wp_enqueue_scripts action, as you would normally use in … Read more

How do I query a single data value from the wp_metadata table?

You need to use get_post_meta: get_post_meta( $post_id, $key = ”, $single = false ) Retrieve post meta field for a post $post_id (int) (Required) Post ID. $key (string) (Optional) The meta key to retrieve. By default, returns data for all keys. Default value: ” $single (bool) (Optional) Whether to return a single value. Default value: … Read more

Pagination issue with tag.php

Never re-do the main query. Hook into pre_get_posts and change it. The following needs to go in your functions.php (putting in the template will mean it runs too late): add_action( ‘pre_get_posts’, function ( $wp_query ) { if ( $wp_query->is_main_query() && $wp_query->is_tag() ) { $wp_query->set( ‘posts_per_page’, 20 ); $wp_query->set( ‘post_type’, [ ‘pavilion’, ‘post’, ‘catalog’, ‘tenders’, ‘services’, … Read more

Add stylesheet per layout

If you are talking about a page template, then you can do a conditional check with is_page_template() and includethe CSS in the header with wp_enqueue_syle(). Something like this: function themename_include_page_specific_css() { if ( is_page_template( ‘template-name.php’ ) : wp_enqueue_style( ‘themename_page_specific_css’, get_template_directory_uri() . ‘/page-specific-style.css’ ); endif; } add_action( ‘wp_enqueue_scripts’, ‘themename_include_page_specific_css’ ); Keep in mind, that the parameter … Read more