adding BB shortcode to BB theme for specific post category

Hello,

I am unable to add the BB shortcode for a global row to posts that are in a certain category. I have searched the forum and tried a few of the options, but none work for me.
(note: I’m a newbie when it comes to php)

What I want to do is to be able to add a logo, and possibly a different menu, etc.
For now, I was able to add a logo below the menu, but it is not ideal, since it doesn’t use the BB shortcode.

here’s url

here’s code I added to single.php:

		<?php elseif (in_category( 'design-blog' )) : ?>
			<div class="fl-content col-md-12 category-design-blog">
			<div class="fl-photo fl-photo-align-center">
				<div class="fl-photo-content">
					<a class="dpb" href="http://kristawatterworth.com/designpalmbeach/" target="_self"><img class="" src="http://kristawatterworth.com/wp-content/uploads/2016/01/design-palm-beach.png" alt="design-palm-beach"/></a>
				</div>
			</div></div>

what I tried to do was add code to functions.php file like this:

if ( is_single() && in_category('design-blog')) : 

add_action('fl_before_content','design_blog_header'); 
 function design_blog_header(){
	 echo do_shortcode('[fl_builder_insert_layout slug="design-blog-header"]');
};
endif;		

but it doesn’t do anything.

thanks,
-matt

Hey Matt,

Try doing it like this instead and see if it works.

function design_blog_header(){
  if ( is_single() && in_category( 'design-blog' ) ) {
    echo do_shortcode('[fl_builder_insert_layout slug="design-blog-header"]');
  }
}
add_action('fl_before_content','design_blog_header');

Ben

worked!

you are a beaver stud!!

thank you so much!

oops. was about to mark as resolved, but just noticed that the post heading is not showing. Is that css?

I saw there’s a thread about a small bug with shortcodes added to posts.

I added css and it’s working fine now

.design-blog header.fl-post-header {
display: inherit;
}

Hey Matt,

Yes, that can be fixed through CSS. The problem there is that once you’ve loaded the layout via the shortcode, it loaded its assets(CSS/JS) as well. And I believe you have set Page Titles to be hidden under Global Settings. Try adding the code below though and see if it works. It should make the post titles on all single posts visible. :slight_smile:

.single .fl-post-header {
  display: block;
}

Ben

Ah, must have been typing my reply when you posted yours. Your code should work fine, since I believe you’re only loading the template on that specific category. :slight_smile:

Ben

yes, sorry abut that. Had typed the reply, but forgot to hit submit… oops

thanks again

No worries at all, Matt! We’re already looking for a fix re the hidden titles, I just thought you might want to know. :slight_smile: Have fun with BB! :slight_smile:

Ben