Custom Post Types

Guys,
I know I’ve asked before, however, can I just run through with you to check if I’m creating custom post types with BB integration the correct way?

  1. To start I install my custom post type plugin
    Create a custom post type (as usual) say Movies and a couple of entries/posts

  2. Then I copy from the BB theme file folder the single.php file and place that copy in my child theme folder
    I then rename the file (in this instance) single-movies.php
    and add the following code if I want a blank movies post page:
    <?php
    /*
    Template Name: Movies
    */
    ?>

<?php get_header(); ?>

<div class=“fl-content-full container”>
<div class=“row”>
<div class=“fl-content col-md-12”>
<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
<?php get_template_part(‘content’, ‘page’); ?>
<?php endwhile; endif; ?>
</div>
</div>
</div>

<?php get_footer(); ?>

I save that file.

  1. In setting - page builder I tick to allow BB page builder to work on newly created post type (movies)
    In my Movies sample post I then launch page builder and this takes me to my movies post blank page

Would you say this is the best or most economical way to create and use BB with a custom post type?

Thanks in advance

Darron

Hey Darron,

This should make your Movies CPT have the same layout as your pages. If that’s what you wanted to do then you’re on the right direction. You should still be able to use BB with CPTs without having to do all that. :slight_smile:

Ben

Thanks Ben

Yeah, I basically want to be able to modify my custom post type pages like this: http://visitscotland.users40.interdns.co.uk/housing/house-one/ where I can make the page how I want with BB rather than here: http://visitscotland.users40.interdns.co.uk/retail/retail-one/ where I haven’t done all that I’ve mentioned above in creating a single-retail.php file.

Are you saying there is an easier way of creating a custom post type page layout however I wish with BB?

Thanks

D

Hey D,

Nope, I was just saying that you can still use BB on posts, but you don’t get to style it however you want like you have on that first link. :slight_smile:

Ben

okay Ben - will stick to previous mentioned method to allow for custom styling of posts using BB - think I’ll create a series of snippets in order just to be able to paste into new custom post type template files in future

Have a great weekend - love the latest beta version btw :slight_smile:

D

Awesome! And thanks, you do the same! :slight_smile:

Ben

the code you have above that goes into your single-movies.php file in the child theme, you replaced the code in the single.php file with the code above, correct?

Hey Andrew,

Replacing your single.php file will affect all posts, be it the regulars posts, or CPTs. If you want to only adjusts a specific CPT, then you can create a new file, e.g., single-movies.php like the CPT above, and it will only affect that. Check the codex below for more info.
https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post

Ben

Hey Ben! I don’t think I was clear. Here’s all I have done.

  1. Installed/Activiated ‘Portfolio post type’ plugin.
  2. Created a single-portfolio.php file in my child theme.
  3. Copied the code from above into that file and replaced the template name with portfolio.
  4. Created a new portfolio item. It lets me select the ‘page builder’ but once I’m there, it won’t actually let me add any rows or modules.

Now, I know I’m missing something, because when I add a ‘new page’ and edit that page, I can select portfolio from the templates. I don’t need that functionality, I need the portfolio items themselves to be editable using the BB page builder.

[Content Hidden]

Hey andrewpeters,

I’ve just performed some test on your Website and it seems everything is working fine on my end. I’ve created a BB test page here for your reference http://cmd.creativeministrydesign.com/portfolio/bb-test-page/ , I’m able to insert rows and modules without issues. Could you please try it on your end? Let us know how it goes.

Thanks!

KC

KC, I know how to get the page builder to work on the portfolio item. I can’t get the page builder to work like it would on a regular page. That is my issue.

Hey andrewpeters,

Sorry, I’m not getting this. Could you tell me a little more about the problem that you’re having? I’m able to use the page builder without issues on your portfolio items. Could you tell me which module is not working for you? Let me know if I am misunderstanding your question. :slight_smile:

Thanks!

KC

I’m not sure how to be more clear?

I want the page builder to operate on a portfolio page the same way it would on a regular page. No sidebar, no titles, not meta data, ect. Just fullwidth page builder.

If you could read my post in this thread from 8:12 on Jan 11 it will tell you what I’ve done so far.

Hey Andrew,

I apologize for the misunderstanding there. Just took a look at the single-portfolio.php file and it seems it is using the content-single.php file on your parent theme to display the layout. Lets try creating a custom layout content-portfolio.php in your Child Theme and change the code as shown below on the single-portfolio.php file.

Replace
<?php get_template_part('content', 'single'); ?>

With this
<?php get_template_part('content', 'portfolio'); ?>

Once you’re done, we’ll start customizing the content-portfolio.php file, such as removing the sidebar, titles and etc. Give it a try and let us know if it works. :slight_smile:

Thanks!

KC

Hi, I am seem to be having a similar problem to the guys above.

I am using the BB child theme.
I have created a CPT called ‘rooms’
I want my regular ‘single’ posts to have a sidebar right (Therefore I have selected that default setting in the customiser.)
However, I would like my CPT ‘rooms’ to have no sidebar.

Can you help?

Thanks
Laurence

Hey Laurence,

The only way around that would be to create a new template for your Rooms CPT. It should be pretty quick on your case.

  1. Copy the single.php from your parent theme and paste it to your child theme.
  2. Rename the file to single-rooms.php. This makes it so that the Rooms CPT will follow what's inside that file instead.
  3. Open up the file, and remove all FLTheme::sidebar instances, there should only be 2, left and right.

That’s the theme modification method to get it done which is what I would suggest. Another method would be via CSS. If you can share a URL where we can see your Rooms CPT’s frontend, I can provide you with the code. :slight_smile:

Ben

[Content Hidden]

Hey Laurence,

Sorry about that, you’ll also want to replace the line <?php FLTheme::content_class(); ?> with col-md-12. :slight_smile:

Ben