WordPress tag or archive php file customization

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

Inserting categories as a hierarchical terms from frontend form

Use wp_set_object_terms( $object_id, $terms, $taxonomy, $append ); to get this done. You are adding everything with add_post_meta which will not add category to your post type. wp_set_object_terms( $post_id, sanitize_text_field($_POST[‘some_field’] ), ‘schooltype’, true ); But here I am also not sure how to assign parent-children relationship via wp_set_object_terms, even it’s not mentioned on WordPress codex! I … Read more