John Davidson

php - How to give a href to redirect to a page in worpdress?

0 comments
Message:


I want the user to click arrow and it will redirect to myproject page in wordpress. Please let me know how to give a link to a page in wp.


<i class="bi-arrow-right"></i>

The code is mentioned below.


<a class="circle-link" href="<?php echo $project07['project_link']; ?>">
<span class="circle-icon">
<i class="bi-arrow-right"></i>
</span>
<span>View Project</span>
</a>


My Answer:
In the code provided, the href attribute is already set to the value of $project07['project_link']. This means that when the user clicks on the arrow icon, they will be redirected to the URL specified in the $project07['project_link'] variable.

Make sure that the value of $project07['project_link'] is the correct URL of the page you want to redirect the user to. If you want to redirect the user to a specific page in WordPress, you can use the permalink of that page as the value of $project07['project_link'].

For example, if you want to redirect the user to a page with the permalink "myproject", you can set $project07['project_link'] to the following:

$project07['project_link'] = get_permalink( get_page_by_path( 'myproject' ) );

This will generate the correct permalink for the "myproject" page in WordPress and set it as the href attribute of the link.

Rate this post

4 of 5 based on 7230 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us