Get all posts from categories

From the it looks like you want to get all products grouped by category. Your query seems to be correct except $term_slug need not be in quotes. $tax_post_args = array( ‘post_type’ => ‘bpo_microsoftoffice’, ‘posts_per_page’ => 999, ‘order’ => ‘ASC’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘bpo_microsoftoffice_reg’, ‘field’ => ‘slug’, ‘terms’ => $term_slug ) ) ); … Read more

Check if tag contains posts

You can use: <?php if (get_tag(’17’)->count > 0) { ?> <?php } ?> get_tag is basically a get_term with taxonomy post_tag and get_term returns WP_Term object on success, WP_Error on error. WP_Term has property $count which has object count for the term in process.

Missing a text-domain esc_attr_e

Don’t know about the error but the strings that are being translated need to be constant strings, not dynamic values. if $l10n[‘no-image-selected’] is already translated then use esc_attr and not esc_attr_e

PHP $_REQUEST array empty

Missing GET request variables are sometimes a symptom of improper rewrite rules in the web-server’s configuration files. In the case of Apache, rewrites are most often implemented using the mod_rewrite module’s directives in the WordPress installation’s directory-level .htaccess configuration file – however, a faulty rewrite rule could also be present in higher-level configuration files (directory, … Read more

add category to posts with tag wordpress

This is just an example to get all posts in the category transportation with the tag car : $args = array( ‘post_type’=>’post’, ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘category’, ‘field’ => ‘slug’, ‘terms’ => array( ‘transportation’ ), ), array( ‘taxonomy’ => ‘tag’, ‘field’ => ‘slug’, ‘terms’ => array( ‘car’ ), ‘operator’ => … Read more

Get parents child pages

Solved it, and decided I could best post my answer here, since people can learn from it 🙂 <?php global $post; $children = get_pages( array( ‘child_of’ => $post->ID ) ); $siblings = get_pages( array( ‘child_of’ => $post->post_parent ) ); // or, if you want to exclude the current page: // $siblings = get_pages( array( ‘child_of’ … Read more

Amend theme php to include certain category in header

You can use the action pre_get_posts. It gets fired after the query object is created but before the query is run. This is an example from the official documentary for displaying only one category: In your functions.php add the following: function my_home_category( $query ) { if ( $query->is_home() && $query->is_main_query() ) { $query->set( ‘cat’, ‘123’ … Read more

How to override a plugins script

In principal, unless there are documented APIs and/or filters to the plugin, you should not do anything that is more then using core hooks if you want to be able to upgrade it in the future. If no appropriate thing is available, you should contact the author and ask for it, or decide that you … Read more