Different layout for custom post type

Posted in: Newspaper
Post count: 61

Hi,
I followed this guide, and
created single-mycpt.php file for my custom post. But all single.*php has same layout: post takes 2/3 of a page, and sidebar takes 1/3.
How to make it 3/4 for post and 1/4 for a sidebar?
Thanks

  • This topic was modified 7 years by pbc.
Post count: 20688

Hi,

That is not possible by a setting, the post templates design is capable of 3 columns of this layout 2/3 +1/3.

For cloud library templates and default post types, the composer can be used to design the templates. This will allow more row layouts
https://www.screencast.com/t/enAeJEC5Usi
But for the moment these cloud post templates can be used only for default post types. Sorry for the inconvenience.

Thanks

Post count: 61

Any third party plugin I can use to achieve this layout?
Or can you point me to the file where in code this can be done?

Thanks

Post count: 20688

Hi,

The layout for the default post templates (which can be used for CPT) will be according to the sidebar position (left, right, no sidebar).
The width of the actual containers is set in the theme stylesheet in general, not just for the post templates. For example a template with a sidebar
https://www.screencast.com/t/qQSgnWTMC
https://www.screencast.com/t/o5UPSqysp
Modifying the values in the stylesheet will have general effects.

The content inside these containers is dependent on these values, changing them may damage the content.
However you could experiment with CSS targeted specifically for the custom post type. The CPT name will be shown as a class on the body. So for example
https://www.screencast.com/t/TfkXRCmK
Code used in example here

.single-td_book .td-pb-span8.td-main-content {
width: 75.66666667%;
}
.single-td_book .td-pb-span4.td-main-sidebar {
width: 24.333333%;;
}

Thanks

Post count: 61

Thanks, Simion, your help much appreciated.

Viewing 5 posts - 1 through 5 (of 5 total)
The forum ‘Newspaper’ is closed to new topics and replies.