Category base 404 – fix

Yes, there is such way. To be precise, there are many ways to accomplish that. You can add ‘Category’ page. Make sure that its slug is set to ‘category’. If you go to example.com/category/ then this page will be shown. If there were no custom changes to rewrite rules, then WordPress will first try to … Read more

Non-Recursive get_term_children()

Presumably you want to output term data, so you can use get_terms with the child_of argument, then iterate over returned terms and check that the parent of each term is your main term id: $parent_id = 42; $children = get_terms( ‘product_category’, array( ‘child_of’ => $parent_id ) ); foreach( $children as $child ) { if( $parent_id … Read more

Random post order and taxonomy filter

Better to use get_posts. This is how you can use “rand” <?php $args = array( ‘orderby’ => ‘rand’ ); $rand_posts = get_posts( $args ); foreach ( $rand_posts as $post ) : setup_postdata( $post ); ?> <!– Do the things here… –> <?php endforeach; wp_reset_postdata(); ?>

Displaying Results From Custom Taxonomy Query

$regions = get_terms(‘region’, array(‘hide_empty’ => false) ); foreach( $regions as $region ){ ?> <li class=”location large-3 columns”> <img src=”https://wordpress.stackexchange.com/questions/126131/<?php echo get_template_directory_uri(); ?>/images/<?php echo $region->slug; ?>.jpg” alt=”” /> <span class=”location-title”><?php echo $region->name; ?></span> </li><?php }

Using a taxonomy value as part of a post URL

Add or replace this to your register_taxonomy (in functions.php): ‘query_var’ => ‘city’, ‘rewrite’ => true Then append this to your functions.php add_filter(‘post_link’, ‘city_permalink’, 10, 3); add_filter(‘post_type_link’, ‘city_permalink’, 10, 3); function city_permalink($permalink, $post_id, $leavename) { if (strpos($permalink, ‘%city%’) === FALSE) return $permalink; // Get post $post = get_post($post_id); if (!$post) return $permalink; // Get taxonomy terms … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)