I’d like to display more than one category name/link in the meta info of each post in Block 12, like in the single posts where you can see more than one. Is there some code from the single post loop that can be re-used to do this in td_module_mx11.php? I don’t want to choose a primary category, I want to be able to display at least two.
http://thekineticist.com/2016/04/15/art-dance-collaboration-in-philadelphia/
Single post > Multiple categories displayed here
Thanks.
Rachel
Hi,
Maybe this topic will help:
https://forum.tagdiv.com/topic/conditional-post-title-coloring-dependant-on-category/
Thanks you!
I’ve resolved in this way:
On Newspaper/includes/modules/td-module_numberofyourmodule.php
i’ve added this:
<div class="td-module-meta-info">
<?php if (td_util::get_option('tds_category_module_11') == 'yes') {
$postid = get_the_ID();
$post_categories = wp_get_post_categories( $postid );
$cats = array();
foreach($post_categories as $c){
$cat = get_category($c);
$cats[] = array( 'name' => $cat->name, 'slug' => $cat->slug);
$catid=get_cat_ID($cat->name);
$category_link = get_category_link($catid);
echo "<a>$cat->name</a>";} ?>
<?php echo $this->get_author();?>
<?php echo $this->get_date();?>
<?php echo $this->get_comments();
/* echo $this->get_category();*/ } ?>
</div>
Istead of:
<div class="td-module-meta-info">
<?php if (td_util::get_option('tds_category_module_11') == 'yes') { echo $this->get_category(); }?>
<?php echo $this->get_author();?>
<?php echo $this->get_date();?>
<?php echo $this->get_comments();?>
</div>
Please, tell me if this can cause any problems on template, and if there is a way to set this for all modules without modifying all the module files.
Thanks.
Gabriele.
-
This reply was modified 7 years by
SerenityStore.
Hi,
@SerenityStore If it causes problems remove the code. Make tests to see if it works as you want. Modify the modules you want in a child theme, this way you will not loose the customization after a theme update.
By default the theme modules are created to display only the primary category of the post
– https://forum.tagdiv.com/primary-category/
Displaying more is not possible by a theme setting, it may also damage the design of the module. Each module will have to be modified in order to allow this.
Maybe in the future such an option will be available, can’t say for sure. Sorry for any inconvenience.
Thanks