How to resolve the conflict of URLs in Wordpress?

The site has a CPT created with slalom data.
On the website there is a heading with slalom data in which there are articles.
You can really do to make it so that for example if there is an entry in the data category site.com/data/article1 the page that opens single.php
but if there is an entry in the CPT data revealed record site.com/data/article2 single-data.php
tells me that it is impossible...
March 20th 20 at 11:24
3 answers
March 20th 20 at 11:26
Hello!
VP knowingly uses the basic URLs... it is focused VP and attaches the corresponding templates to CPT. Accordingly, the normal and correct way possible. Spike method is to attach the template manually to a specific url level functions.php Not recommended in General...
March 20th 20 at 11:28
tells me that it is impossible...

Not a trivial task, but probably solvable. Face not so often, but not remember a case that was not possible to correct the URLs.

Links for inspiration:

If you want, I think you can try to Google, but as noted by @daniella_Hahn43, this change is needed only if You are really sure that You need it, or You was well paid :).
For example, here is a recommendation from WooCommerce on this theme.
March 20th 20 at 11:30
You can as an option in the file single.php to write the condition
if( is_singular($post_types) ){ 
 // ... 
}


and place the code you want to display for the type of record.

For example:

if( is_singular('data') ){// instead of data you need to write a specific type of record
?>
 <div class="entry-content custom-post-type">
<?php
the_content();
?>
 </div><!-- .entry-content -->
<?php
} else {
?>
 <div class="entry-content simple-post">
<?php
the_content();
?>
 </div><!-- .entry-content -->
<?php
}

Find more questions by tags WordPress