Show portfolio category slug in url ( if exist)
To get the portfolio category in the url you could possibly navigate to Settings > Permalinks and add a custom structure like so %category%/%postname% that will add the category before the postname.
To get the portfolio category in the url you could possibly navigate to Settings > Permalinks and add a custom structure like so %category%/%postname% that will add the category before the postname.
I was able to achieve this by following code: $allterms = get_terms( $taxonomy ); $pterms = get_the_terms( $post->ID, $taxonomy); $tag_list = implode(‘,’, wp_list_pluck($pterms, ‘term_id’) ); $t = explode(‘,’, $tag_list); echo ‘<div class=”tag-cloud”>’; foreach ($allterms as $term) { if (in_array($term->term_id, $t)) { echo ‘<span class=”stag active”>’.$term->name.'</span>’; } else { echo ‘<span class=”stag inactive”>’.$term->name.'</span>’; } } echo … Read more
If I am reading your code and description correctly, you can simplify that to: $taxonomy = ‘delivery_option’; $do = get_the_terms($post->ID,$taxonomy); if (!empty($do) && !is_wp_error($do)) { $do = array_shift($do); // assuming a single value as per the description. $term = str_replace(‘-delivery’,”,$do->slug); get_template_part(‘includes/sidebar-part’,$term); } else { echo ‘<p>No custom include!</p>’; } Note, I used WordPress’s get_template_part() instead … Read more
I added this to my child-theme’s functions.php file and it works 100% add_action( ‘template_redirect’, ‘redirect_archive’ ); function redirect_archive() { if ( is_tax(‘location’) ) { $termurl = get_query_var( ‘term’ ); wp_redirect( home_url(‘/search/location/’.$termurl), 301 ); exit; } }
ajax drop down change second drop down data
SOLVED: This is issue was solved by correctly flushing rewrite rules: global $wp_rewrite; $wp_rewrite->init(); //important… $wp_rewrite->flush_rules();
Dynamic value for get_option linked to taxonomy term_id?
taxonomy query on front page
This depends on how your theme handles Taxonomy pages. If it e.g. has a category.php that does stuff different than taxonomy.php or archive.php this is the reason. Have a look here to see how the template hierarchy works.
put this code in functions.ph define(‘IMAGES’,get_stylesheet_directory_uri().’/img’); where img is the directory where the images for the flags are present <?php get_header(); $queried_object = get_queried_object(); $term = $queried_object->name; switch ($term) { case “china”: echo ‘<img src=”https://wordpress.stackexchange.com/questions/194142/<?php echo IMAGES; ?>/china.jpg”>’; break; case “russia”: echo ‘<img src=” <?php echo IMAGES; ?>/russia.jpg”>’; break; case “india”: echo ‘<img src=” <?php … Read more