How to Create a Linkpage

Sometimes you don’t want to have a list of your bookmarks in your blog’s sidebar, but on a separate page. In this article I would like to give you a small tutorial on how to do this.

Solution: WordPress page-template

To create a linkpage you have to go to your current theme-directory and make a copy of the file page.php. It is very likely that the listings further below will not work with your theme. You have to work with a copy of the file page.php from your theme.

For this tutorial, the copy is named page-feedreading-blogroll.php, but you can choose any name you want.

So we start by copying page.php from your theme-directory and by naming the copy page-feedreading-blogroll.php.

Now, we open page-feedreading-blogroll.php in an editor. The file might be looking something like this. Your file might be looking quite differently.

But one similarity will be there: the content-template-tag:

<?php the_content(); ?>

You will find this tag in the listing of page.php below: page.php / unmodifiyed page-feedreading-blogroll.php:

<?php get_header(); ?>
<div id="content-container">
<div id="content">
<div id="body">
		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
		<div class="post" id="post-<?php the_ID(); ?>">
		<h2><?php the_title(); ?></h2>
				<div class="entry">
						<?php the_content(); ?>
				</div>
		</div>
		<?php endwhile; endif; ?>
		<?php edit_post_link(‘Edit this entry.),<p>,</p>); ?>
</div>
<?php if ( get_option(‘page_setup’) != ‘no-sidebar’ ) get_sidebar(); ?>
</div>
<div class="clear"></div>
</div>
<?php get_footer(); ?>

Just below of the_content(); is the best place for the template-tag of the blogroll. Furthermore, notice the first five line of the modified page-feedreading-blogroll.php. A name for the template was added. In this case it’s Feed Reading Blogroll Page. Apply the changes to your own template and save them.

Now that the plugin’s template-tag and the template-name have been added, the modified file should look something like this: modified page-feedreading-blogroll.php:

<?php
/*
Template Name: Feed Reading Blogroll Page
*/
?>
<?php get_header(); ?>
<div id="content-container">
<div id="content">
<div id="body">
		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
		<div class="post" id="post-<?php the_ID(); ?>">
		<h2><?php the_title(); ?></h2>
				<div class="entry">
						<?php the_content(); ?>
						<?php feedreading_blogroll(); ?>
				</div>
		</div>
		<?php endwhile; endif; ?>
		<?php edit_post_link(‘Edit this entry.),<p>,</p>); ?>
</div>
<?php if ( get_option(‘page_setup’) != ‘no-sidebar’ ) get_sidebar(); ?>
</div>
<div class="clear"></div>
</div>
<?php get_footer(); ?>

This modified file should now be uploaded to the directory of your theme.

Now, go to your blog’s admin-section and create a new page.

Toward the bottom of the Write > Page administration panel (or on the sidebar, depending on which version of WordPress you are using) is a drop-down labeled “Page Template.” From there you can select which Template will be used when displaying this particular Page.

Select the page template called “Feed Reading Blogroll Page” – that is the one you have just uploaded to your theme-directory.

Save and publish the page.

That’s it – view the page on your blog. It should contain the blogroll! Further resources at the WordPress codex

 
feedreadingblogroll/linkpage.txt · Zuletzt geändert: 2009/09/20 14:53 von theboss
 
Falls nicht anders bezeichnet ist der Inhalt dieses Wikis unter der folgenden Lizenz veröffentlicht:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki