Site logo

Archived topic

Apply single.php from the "Explore" theme from the site library to a CPT

3 replies · Started by Rafael on April 1, 2023

Viewing posts 1–4 of 4

Hi there,

I'm pretty new to customizing a theme. Even though I've built quite a few sites for personal experiments in the past, I usually just use the themes as they are, out-of-the box.So this is my first rodeo :)

I just created a new site and (first mistake I made) I downloaded the "Explore" theme from the site library and didn't create a child theme. I've just started working with it as is. I am now at a point where I like what I have, but no child theme.

First question: I should have created a child theme first, right? Is there any way to do so now without losing my theme changes? I've mostly just been personalizing the frontpage, the menus, etc.

Second question: I've created a custom post type, let's call it "projects" to stay consistent with the documentation here. I want to apply the same layout, theme,etc to the CPT as the one seen for posts here. I followed the steps in the documentation, but I can't make it work. I've tried adding this:
get_template_part( 'content', 'projects' );
and this
generate_do_template_part( 'projects' );

And I can't get it to work. What am I missing?

Thanks!

Hi there,

1. If you are not going to edit PHP templates then you do NOT need a child theme.

2. You do NOT need this code, as the Explore site template is using block element - content template for the single post, and the page hero is added using a block element - page hero, these are block-based template, there's no specific PHP templates for single posts.

You just need to find these 2 elements at appearance > elements, and add the single CPT to the 2 element's display rule > location.

Awesome, thank you @Ying! Marked as resolved.

Glad to hear that :)

This archived topic is closed to new replies.