Content Marketing

Add a Links Page to your WordPress Template

We were working on a client site today to add an iPad Cover Review list to the site. Rather than listing them all out in a page or a post, we decided to build a template page that pulled one link category from WordPress’ build in Links section, called “Reviews”.

The WordPress API already has a built in function, called wp_list_bookmarks, that formats the bookmarks out in an unordered list format. The problem is that you can’t add a target to the anchor tag to make the links open in a new tab or window. So… you need to write your own loop to make that happen. You can do this with the get_bookmarks function.

First, I’m going to capture the links into an array and order them ascending, by name, directly from the Reviews link category. Then I output the HTML to produce the list:

<ul><?php $links = get_bookmarks( array(
				'orderby'    => 'name',
				'order'     => 'ASC',
				'category_name' => 'Reviews'
             ));

			// Loop through each bookmark and display the formatted output
			foreach ( $links as $link ) { 
  				echo '<li><a href="'.$link->link_url.'" target="_blank">';
  				echo $link->link_name.'</a> – ';
				echo $link->link_description;
				echo '</li>';
			} ?></ul>

Now you can generate the list however you would like with whatever styling you’d like. We’ve taken it to the extreme on our corporate site for reviewing our client list, where we also integrated live thumbnail images of the sites. You can even add a nofollow tag.

Douglas Karr

Douglas Karr is the founder of the Martech Zone and a recognized expert on digital transformation. Douglas has helped start several successful MarTech startups, has assisted in the due diligence of over $5 bil in Martech acquisitions and investments, and continues to launch his own platforms and services. He's a co-founder of Highbridge, a digital transformation consulting firm. Douglas is also a published author of a Dummie's guide and a business leadership book.

Related Articles

What do you think?

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Close

Adblock Detected

Martech Zone is able to provide you this content at no cost because we monetize our site through ad revenue, affiliate links, and sponsorships. We would appreciate if you would remove your ad blocker as you view our site.