Black Friday Sale! Get up to $40 off GP Premium!Learn more

[Resolved] jetpack projects post type conflicts

Home Forums Support jetpack projects post type conflicts

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #491422
    drew

    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.

    GeneratePress 2.0.2
    GP Premium 1.5.6
    #491702
    Tom
    Lead Developer
    Lead Developer

    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 πŸ™‚

    #491708
    drew

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

    #491879
    Tom
    Lead Developer
    Lead Developer

    Have you tried using the shortcode?: https://en.support.wordpress.com/portfolios/portfolio-shortcode/

    That way you can just use a regular page.

    #492072
    drew

    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.

    #492246
    drew

    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

    #492660
    Tom
    Lead Developer
    Lead Developer

    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

    #492767
    drew

    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!

    #493051
    Tom
    Lead Developer
    Lead Developer

    I agree, I’m not a big fan of Jetpack at all. CPTs are generally pretty simple πŸ™‚

    #493074
    drew

    I’ll certainly put in a plug here for your Lightweight social media plugin: https://generatepress.com/lightweight-social-icons/

    It’s a critical plugin for anyone looking for a Jetpack “cut the cord” option!

    #493345
    Tom
    Lead Developer
    Lead Developer
Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.