Site logo

Archived topic

jetpack projects post type conflicts

10 replies · Started by Drew on February 8, 2018

Viewing posts 1–11 of 11

I'm trying to use a JetPack custom post type (Projects) and have discovered that it's layouts aren't applying inside GP.

Example: single projects page inside GP http://amarillosymph.staging.wpengine.com/artists/chris-rogerson/

  • the sidebar layout for "posts" is being applied
  • none of the post's layout settings are being applied

Here's the same custom post type page on the install currently using a non-GP theme: http://amarillosymphony.org/artists/chris-rogerson/

I found an old thread here from 2016 where someone mentioned using a child theme, which I really hope can be avoided, but in the end, how can I get JetPack's layout and custom post type functionality to apply?

Many thanks,
Drew

P.S. I went through TOm's snippets but didn't see anything.

Hi Drew,

Does Jetpack assume the HTML structure, or is there anywhere you can apply your own structure?

GP needs a specific structure for the content area and sidebars.

Let me know :)

I wish I knew the answer but that's going to be just enough past my skill ceiling to know.

Yes, the shortcodes that produce the index pages appear to be working fine,

The trouble is with the individual posts. Their default formatting places the featured image in a left column and the post's title, taxonomy meta, and copy in a right column.

It's that layout which isn’t rendering.

Well here's an interesting update. I tried completely disabling the custom post type, then disabling Jetpack, removing all of the autoloaded data from wp_options, then activating everything again. Now the single post layouts are being recognized.

There was a need to add this CSS to remove the featured image from showing at the top (even though featured images for posts was deactivated in settings):

/*REMOVE FEATURED IMAGE FROM JETPACK PROJECTS SINGLE PAGE*/
.single-project .single-featured {
    display: none;
}

the only other oddity is the per post layout settings were being ignored. For example, I had the default Post layout as Content:Sidebar but had the layout>sidebars on each custom post type set to "Content (no sidebars)" - unfortunately, the right sidebar was still being displayed on the front end.

Which means I now have to reverse engineer everything and manually set each individual default post layout to content:sidebar unless you have an idea about how to correct that.

Drew

Weird, I wonder what's going on with their code..

We can use a filter to target the sidebar layout for that post type:

add_filter( 'generate_sidebar_layout', 'tu_single_cpt_sidebar_layout' );
function tu_single_cpt_sidebar_layout( $layout ) {
 	// If we are on a category, set the sidebar
 	if ( is_singular( 'artists' ) ) {
 	 	return 'no-sidebar';
 	}

 	// Or else, set the regular layout
 	return $layout;
 }

You can find the available values here: https://docs.generatepress.com/article/sidebar-layout/#using-a-function

Many thanks, this is probably Jetpack's last straw for me; I found another thread here where you're pointing out the value of simply creating a CPT and after finding a plugin that migrates meta from one CPT to another, I'm finding that it brings over everything except the non-feature image gallery images. All things being equal, having one more reason to be rid of Jetpack is a good thing!

I agree, I'm not a big fan of Jetpack at all. CPTs are generally pretty simple :)

Thanks! :)

This archived topic is closed to new replies.