How to call single.php file using dynamically posts in wordpress?

I have this href link which is dynamically posted, I want to get the single.php file and the dynamically posts to be redirected to my single.php file Here is my link below:

<a href="/single-<?php the_ID();?>-<?php the_slug(); ?>" class="wrapper" style="background-image:url('<?=$url?>')">

When I click on the link the URL is this way:

Read More
/single-137-2014-inaugural-diversity-abroad-conference-4

And I want that page to be redirected to my single.php file. How will I be able to do this?

Any help is muchl appreciated. TIA

Related posts

Leave a Reply

1 comment

  1. I have solved your problem but please read about the get_permalink() function

    <a href="<?php echo get_permalink(); ?>" class="wrapper" style="background-image:url('<?=$url?>')">
    

    get_permalink() – Retrieves full permalink (link of a post) for the current post or post ID. This link will be opened post single page, which means if this is a custom post type and you create it as a separate single-post-type.php, then it will be as an open single-post-type.php page. Otherwise it appears as single.php.

    For your information, posts have been opened in single.page while page opened with page.php. read about this link https://codex.wordpress.org/Post_Type_Templates