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.
services
, or is it something else, likeservice
orprefix_service
? Your template files need to use the exact post type name as defined in theregister_post_type()
call that creates the post type.