Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Converting my HTML template to WP Theme I am confused how to linkto the pages in WP? For Example I have an Item div which I would like to link to my store page when user click on that but I dont know how to get the correct URL for my store page?! This is also happening when I would like to link from another site to my page for example how I can link to my page from here?
http//www.ghazalphoto.portfolio.html Or
http//www.ghazalphoto.portfolio.php Or
http//www.ghazalphoto.portfolio

share|improve this question

2 Answers 2

Use this to output correct link:

<?php 
   $page = get_page_by_title( 'Store' );
   echo get_permalink( $page );
?>

Or if you know ID of your page (you can get ID from administration), you can use just (if ID is 2)

<?php echo get_permalink( 2 ); ?>

You can read more about get_permalink function here

And I would also suggest you to read something about wp_nav_menu function to enable your theme to use Navigation menus.

share|improve this answer

When you create a page in wordpress it works like a template in your case to create a portfolio page you need to create a page-portfolio.php file in your theme folder.

Add on first line:

 <?php
 /*
 Template Name: Portfolio Page
 */
 ?>

Build your portfolio page here. Create a page in Administration-> Pages-> Add New. Select 'Portfolio Page' from drop down on right side. Publish and take note of the now live URL.

In WordPress you can link in the code like:

<a href="portfolio pages live link"<div>Link to Portfolio Page</div></a>
// or
<a href="<?php $page = get_page_by_title( 'Behseinis Page' );echo get_permalink( $page ); ?>">
<div>Link to Portfolio Page</div></a>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.