0

I have a CPT from a theme I bought called "Services" and it uses the index.php file. I have also created a page called "/services", but the CPT is outputting a page to override it.

I tried creating both a archive-services.php and single-services.php page with:

$args = array(
    'p' => 795
);
$custom_query = new WP_query( $args );

if( $custom_query->have_posts() ) {
   $custom_query->the_post();
   the_title();
   the_excerpt();
   wp_reset_postdata();
}
wp_reset_query();

// With get_post()

$get_content = get_post( 795 );
setup_postdata( $get_content );
the_title();
the_excerpt();
wp_reset_postdata();

In the attempt to pull the page data and output it in the theme file, but even with this, and I don't even know if that's correct, the Services page uses index.php.

I just want my page to take over.

2

1 Answer 1

0

you need to find out your exact CPT name (is it just services?) and that will be the archive-services.php and single-services.php.

Those need to be either in your theme folder or if you're using a child theme (you should be) these files will be in your child theme folder.

show us the code to create your CPT from theme code to create the CPT and that will give us more info.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.