-
AuthorPosts
-
September 8, 2014 at 7:52 pm #315313
Hi guys, I have a couple questions on how to do some things on the Portfolio Page title bar. Take a look at this page: http://www.crude.com/media/ogir-texas-electricity-natural-gas/
1. I would like the Category to display instead of the title on the title bar. For the link above, the title bar (dark gray background) displays the title (OGIR: Texas Electricity to Be Met…), and I’d like it to display the lowest level category (Oil & Gas Investing Report).
2. The breadcrumb to the right is displaying the wrong category here. Its showing “Infographics” instead of “Podcasts & Radio > Oil & Gas Investing Report”. It should display “You are here: Home / Media / Podcasts / Oil & Gas Investing Report / OGIR: Texas Electricity to Be Met Almost Entirely by Natural Gas”.
3. Is it possible to hide the display of the post title at the end of the breadcrumb above?Thank you guys for all your support!!
Dave
September 9, 2014 at 4:19 am #315562Hi atrixdave!
Thank you for using Enfold.
1.) Try adding this on functions.php:
function avf_portfolio_title_args($args) { $title = get_the_title($id); if(is_singular('portfolio')) { $terms = get_the_terms( $id, 'portfolio_entries' ); $portfoliocat = array(); foreach ( $terms as $term ) { $portfoliocat[] = $term->name; } $args['title'] = $portfoliocat[0]; } else { $args['title'] = $title; } return $args; } add_filter('avf_title_args', 'avf_portfolio_title_args', 10, 1);
2.) Set the the Media page as parent page of the Podcasts page. See if that changes the breadcrumbs.
3.) Add this on Quick CSS or custom.css to hide the post title:
span.trail-end { display: none !important; }
Cheers!
IsmaelSeptember 9, 2014 at 6:48 am #315653Thanks for the reply Ismael.
1) I added this to functions.php in my child theme and its still showing the portfolio item title instead of the category on the title bar.
2) This isn’t working.
3) Hides the post title but also hides the page titles. So for instance if you go to the Podcasts page, it says “You are here: Home /”
http://www.crude.com/podcasts/. Any way to only hide post titles and not page titles?September 10, 2014 at 4:36 pm #316728Hi!
For #2, you also need to choose to use manual parent pages on each single portfolio item from the meta box on the right. Otherwise the breadcrumbs use session data to figure out where the user came from when viewing the page. Its the very last one by default labeled “Breadcrumb Hierarchy”.
#3 – You could do:
.single-portfolio span.trail-end { display: none !important; }
So that it only effects the single-portfolio page class. Though this is a bit odd in practice as breadcrumbs always show the end as being where the user actually is.
For #1 I don’t know of any other way if Ismaels snippet isn’t working for you. If its a must-have customization you can look into a freelance developer from somewhere like Envato Studio or Codeable.
Regards,
DevinSeptember 11, 2014 at 1:37 am #317068Thanks Devin! Your solutions for #2 and #3 work. Would be great if you could set a default way for breadcrumbs to be handled vs it being figured out by session.
As far as #1, yeah I copied and pasted Ismael’s code into functions.php and Im still seeing the portfolio item title there instead of the category…
September 11, 2014 at 2:09 am #317088Hey!
For #1, try this code instead:
add_filter('avf_title_args', 'avf_portfolio_title_args', 10, 1); function avf_portfolio_title_args($args) { $title = get_the_title($id); if(is_singular('portfolio')) { $terms = get_the_terms( $id, 'portfolio_entries' ); $portfoliocat = array(); foreach ( $terms as $term ) { $portfoliocat[] = $term->name; } $args['title'] = $portfoliocat[0]; } else { $args['title'] = $title; } return $args; }
Cheers!
JosueSeptember 11, 2014 at 4:09 am #317122Thank you Josue! That did the trick! You guys are awesome
September 11, 2014 at 4:13 am #317125You are welcome, always glad to help :)
Regards,
JosueSeptember 11, 2014 at 4:21 am #317128Ok now I have the same issue for posts :)
How do I accomplish the same 2 things?
Take a look at this page: http://www.crude.com/powering-america-premiers-daily-radio-talk-show-devoted-issues-energy/
1. I would like the Category to display instead of the title on the title bar. For the link above, the title bar (dark gray background) displays the title (“Powering America” Premiers…), and I’d like it to display the lowest level category (In the Press).
2. How to hide the Post title in the breadcrumb without hidng pages as well?September 12, 2014 at 7:55 am #317923Hey!
Try the following:
add_filter('avf_title_args', 'avf_portfolio_title_args', 10, 1); function avf_portfolio_title_args($args) { $title = get_the_title($id); if(is_singular('portfolio')) { $terms = get_the_terms( $id, 'portfolio_entries' ); }elseif(is_singular('post')){ $terms = get_the_terms( $id, 'category' ); } if(is_singular(array('portfolio', 'post'))) { $portfoliocat = array(); foreach ( $terms as $term ) { $portfoliocat[] = $term->name; } $args['title'] = $portfoliocat[0]; } else { $args['title'] = $title; } return $args; }
Cheers!
JosueSeptember 12, 2014 at 8:02 pm #318305Thanks Josue…unfortunately post pages display as a blank white screen when I use that code on functions.php. Any other ideas?
September 12, 2014 at 9:04 pm #318328Hi!
That code worked on my end, can you check your PHP error log for some insight?
Cheers!
JosueSeptember 17, 2014 at 10:18 pm #320766Sorry if this is a dumb question, but how do I do that? Is that enabled by default?
September 17, 2014 at 11:49 pm #320789Hi,
Can you please create me an administrator account? post it here as a private reply.
Regards,
JosueSeptember 23, 2014 at 7:54 pm #323876This reply has been marked as private.September 29, 2014 at 2:19 am #326261Hey!
It should work now, you needed to remove the old code in child functions.php.
Best regards,
JosueSeptember 29, 2014 at 9:12 pm #326808Fixed! Thank you Josue!!!
September 29, 2014 at 10:10 pm #326833You are welcome, glad to help :)
Regards,
Josue -
AuthorPosts
- You must be logged in to reply to this topic.