Exporting Custom Taxonomy Description without Plugin
Exporting Custom Taxonomy Description without Plugin
Exporting Custom Taxonomy Description without Plugin
You will be able to get the list of custom taxonomy by following code : <?php //list terms in a given taxonomy using wp_list_categories (also useful as a widget if using a PHP Code plugin) $taxonomy = ‘genre’; $orderby = ‘name’; $show_count = 0; // 1 for yes, 0 for no $pad_counts = 0; // … Read more
This should hopefully help you on your way, although I’ve not fully tested it… The basic search form here which will load the site_url() with appended search query string. You should change this to better reflect your site layout such as <?php site_url( ‘search’ ); ?> (‘http://website.com/search‘). Place the Results page code within the results … Read more
You would need to find the archive.php from your parent theme and copy it to your child theme if you haven’t already. Rename it to archive-question.php (based on your CPT type above). Then open the php file and look for where it outputs your title. Add “Questions on” in front of the output. Without seeing … Read more
One approach is to use JavaScript to add the maxlength attribute to the term description field: function wpse_term_description_attributes() { ?> <script type=”text/javascript”> jQuery(document).ready(function($) { $( ‘.taxonomy-custom_taxonomy_name #description, .taxonomy-custom_taxonomy_name #tag-description’ ).attr( ‘maxlength’, ’20’ ); }); </script><?php } add_action( ‘admin_head’, ‘wpse_term_description_attributes’ ); Replace custom_taxonomy_name with the name of your taxonomy, and customize the value assigned to the … Read more
I’d recommend using get_the_terms instead of get_terms. It specifically pulls out the terms that are attached to a given post. If you use it within the loop, it’ll only give you the terms that are attached to that post. It’d look something like this: $query = new WP_Query( $args ); if ( $query->have_posts() ) : … Read more
Ok, found it, sorry for the noise !… //fetch the terms of my tax $terms = wp_get_post_terms( $post->ID, ‘tool’); $terms_ids = []; //an array, which can contain several terms foreach ( $terms as $term ) { $terms_ids[] = $term->term_id; } // Query $args = array( ‘post_type’ => ‘technical_post’, ‘posts_per_page’ => 4, // How many items … Read more
You need to change your ‘orderby’ parameter. $term_args = array( ‘number’ => $per_page, ‘offset’ => $offset, ‘orderby’ => ‘slug’, ); $terms = get_terms(‘my_taxonomy’, $term_args); WordPress slugs automatically remove punctuation and such so this is probably all you need to do in order to accomplish what you want.
I just found out what I was doing wrong. Apparently you have to place archive pages in the root folder of your theme. I placed them in a subfolder called templates. This works for page templates with a template name, but not for taxonomy.php, archive.php, single.php etc.
Update you code with this <?php // Output all Taxonomies names with their respective items $catCount = 0; $terms = get_terms(‘sermon-series’); foreach( $terms as $term ): ?> <div class=”sermon_title_area”> <h3><?php echo $term->name; // Print the term name ?></h3> <div class=”sermon_date”> <p><?php echo $term->description; ?></p> </div> </div> <div class=”flexslider carousel”> <ul class=”slides”> <?php $posts = get_posts(array( … Read more