Show posts of one category only with Custom Taxonomy on single.php

Since I’m not sure if you are using single.php for anything else, I am going to suggest that you copy single.php to single-14kgs.php in the theme directory. Once you have done that, modify the following: <?php next_posts_link(); ?> becomes… <?php next_post_link(‘%link’,’%title’,TRUE) ?> and <?php previous_posts_link(); ?> becomes… <?php previous_post_link(‘%link’, ‘%title’, TRUE); ?> The third argument … Read more

where can i add custom script to stop header video from autoplay

If you have your own theme or a child theme then you can add this in script tags to one of your templates. I’d suggest your footer template, just after the call to <?php wp_footer(); ?> <script> jQuery( document ).ready( function() { jQuery( document ).on( ‘wp-custom-header-video-loaded’, function() { jQuery(“#wp-custom-header-video”).attr(‘autoplay’,false); }); }); </script> Note that I’ve … Read more

How do I change parameters without changing the core

If you scroll further down the comment-template.php file, you’ll notice that the next available filter you can use is comment_form_defaults. With this filter you can change the default comment form configuration. add_filter( ‘comment_form_defaults’, ‘filter_comment_form_defaults’ ); function filter_comment_form_defaults( $defaults ) { $defaults[‘comment_field’] = sprintf( ‘<p class=”comment-form-comment”>%s %s</p>’, sprintf( ‘<label for=”comment”>%s</label>’, _x( ‘Please leave a comment…’, ‘Comment … Read more

Display posts in random post types

There is no easy query that will do that (see below). You will need to process your results in PHP to get the sort you are looking for. Something like this: $args = array( ‘posts_per_page’ => 5, ‘orderby’ => ‘post_date’, ‘order’ => ‘DESC’, ‘post_type’ => array(‘post’, ‘book’), ‘post_status’ => ‘publish’ ); $posts = get_posts( $args … Read more

Create single.php for specific category by category id

You can use this function to add category specific single template pages on your website. This goes in functions.php You can define as many single templates as you want. function wpse_category_single_template( $single_template ) { global $post; $all_cats = get_the_category(); if ( $all_cats[0]->cat_ID == ‘1’ ) { if ( file_exists(get_template_directory() . “/single-cat1.php”) ) return get_template_directory() . … Read more