I'm simply trying to add - <?php the_category(', '); ?> next to the title in the h1 tag, but it's not working. Could you suggest something else that will print the category names? Thanks in advance.
That didn\'t seem to work. It\'s still outputting the title just fine, but it\'s not showing the category. And I\'d still like the category to be seperated by a dash.
Thanks for the reply! Unfortunately those solutions didn\'t work either. I\'m developing on a private server, but here\'s an example of the same thing working on another site.
I\'ve tried it inside and out of the H1 with no change. I\'ve also tried the variation you sent. I just don\'t understand why the title reference works, but not the category. Any ideas?
The_category shows the category of a post. I think you\'re looking for something else, like the category of the portfolio filter, which is something different. So with your code, it tries to show a category which probably isn\'t there.
Ah, that makes sense, I didn\'t realize they were different. Is there a reference I could use for the portfolio category? I don\'t know if I formatted it right, but I tried the following and got nothing:
I'm trying to add a category listing to the header in single-portfolio.php here:
<?php nectar_page_header($post->ID);
if(empty($bg) && empty($bg_color)) {?>
<div class="row project-title">
<div class="container">
<div class="title-wrap">
<div class="col span_12 section-title <?php if(empty($options['portfolio_social']) || $options['portfolio_social'] == 0 || empty($options['portfolio_date']) || $options['portfolio_date'] == 0 ) echo 'no-date'?>">
<h1><?php the_title(); ?></h1>
<?php
$options = get_option('salient');
–––––––––––––––
I'm simply trying to add - <?php the_category(', '); ?> next to the title in the h1 tag, but it's not working. Could you suggest something else that will print the category names? Thanks in advance.
Thanks
ThemeNectar Support Team
That didn\'t seem to work. It\'s still outputting the title just fine, but it\'s not showing the category. And I\'d still like the category to be seperated by a dash.
Hi, This should work for a dash: <?php the_category(\'- \'); ?>
Also, try to put it outside/after the H1.
You may try get_the_category() as well.
What category name should it display? Do you have an online example?
Thanks for the reply! Unfortunately those solutions didn\'t work either. I\'m developing on a private server, but here\'s an example of the same thing working on another site.
http://www.digitalbase.com/_2015/portfolio/zimmerman-honda/
According to the code, it should say, \"Zimmerman Honda - HOME\".
I\'ve tried it inside and out of the H1 with no change. I\'ve also tried the variation you sent. I just don\'t understand why the title reference works, but not the category. Any ideas?
(edited)
The_category shows the category of a post. I think you\'re looking for something else, like the category of the portfolio filter, which is something different. So with your code, it tries to show a category which probably isn\'t there.
Ah, that makes sense, I didn\'t realize they were different. Is there a reference I could use for the portfolio category? I don\'t know if I formatted it right, but I tried the following and got nothing:
;(
Oh well, thanks for your help.