WordPress permalink outside loop

Add Tool

Display WordPress permalink outside loop


Hello learners, How are You? In this tutorial I will present a simple WordPress snippet that will help you to display WordPress permalink outside loop. We simply use the_permalink() template tag to display post or page links within loop. You can see WordPress cheat sheet for more details about default WordPress template tags. To display permalinks outside of the loop, we may use the below snippets.

<a href="<?php echo get_permalink(472); ?>" ><?php echo get_the_title(472); ?></a>

Description of above snippets:

Here 472 is post ID. You should change it with your post ID. <?php echo get_permalink(472); ?> is calling post link or permalink <?php echo get_the_title(472); ?> is calling post title

Display WordPress permalink

Now you can Display WordPress Permalink Outside of loop as many as by copy and past the snippets where you want. If your widgets support PHP codes you can display it using text widgets. If you text widgets does not support php codes you can see How to execute PHP code on WordPress widgets. Now see an Example to Display WordPress Permalink Outside of the Loop

<ul>
<li><a href="<?php echo get_permalink(472); ?>" ><?php echo get_the_title(472); ?></a></li>
<li><a href="<?php echo get_permalink(3540); ?>" ><?php echo get_the_title(3540); ?></a></li>
<li><a href="<?php echo get_permalink(750); ?>" ><?php echo get_the_title(750); ?></a></li>
</ul>

Simply add the above snippets where you want to Display WordPress Permalinks Outside of the Loop and change the page ID or post ID. This code will display 3 specific post.


Tags: WordPress snippet,
Payza

About Masum Billah

Display WordPress permalink outside loop 1stWebSuite website seo tool is a free website ranking tool site provides a lot of on page and off page seo useful tools for you. On this site, we have a large number of website ranking tools


SIGN UP TO GET UPDATE TO YOUR INBOX




Discuss about: WordPress permalink outside loop


adf.ly