2

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:

/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

1
  • In href write just <?php get_permalink() ?> they will be goto that single.php page Commented Jun 6, 2016 at 3:17

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

1 Comment

the page template now is ok.. i tried to get <?php the_title(); ?> and it is ok.. but <?php the_content(); ?> is now working?

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.