Adding Registration and Login Links

Something missing from this template are the links to register and log in to the blog. Most WordPress blogs, being one-person blogs, don't need these links. Many themes don't even bother to include them. For a community blog, you will want to add them to your theme. To the index.php template file, add the code highlighted in bold in Listing 16-7.

Listing 16-7. WordPress Template Tags for Registration and Login Links Added to index.php

"show_description"=>FALSE, "num_items"=>10)); ?> </ul>

<h2><?php _e('Contribute'); ?></h2> <ul id="contribute"> <?php wp_register(); ?> <li><?php wp_loginout(); ?></li> </ul>

The additions in Listing 16-7 are standard WordPress template tags. The call to wp_register() produces a link to the registration page, but it does so only if registration is enabled. If you are logged in, however, it produces a link to the administration pages.

The call to wp_loginout produces a link to the login page if the current visitor is not already logged in, and a logout link if the visitor is logged in.

Next, add the CSS rules from Listing 16-8 to the end of the style sheet. This will ensure the display of the links matches that of the other parts of the sidebar.

Listing 16-8. CSS Rules for Login and Register Links Added to style.css ul#contribute {

list-style-type: none; margin:0;

padding-left: 10px;

ul#contribute li { margin-top: 4px; margin-left: 1em; text-indent: -1em;

Figure 16-13 shows how your register and login links should appear, and Figure 16-14 shows the site admin and logout links.

Figure 16-13 shows how your register and login links should appear, and Figure 16-14 shows the site admin and logout links.

lis Site

15 16 17 18 19 20 21 g Comments 22 23 24 25 26 27 28 uthors 29 30 31

15 16 17 18 19 20 21

sing Comments 22 23 24 25 26 27 28

e Authors 29 30 31

lis Site

15 16 17 18 19 20 21 g Comments 22 23 24 25 26 27 28 uthors 29 30 31

15 16 17 18 19 20 21

sing Comments 22 23 24 25 26 27 28

e Authors 29 30 31

29 30 31

Del.icio.us Links del. icio, us/doc/feeds/js WordPress Plugins

Del.icio.us Links del. icio, us/doc/feeds/js WordPress Plugins

Database Dr Dave » Spam Karma 2.0 HaloScan.com - Weblog

Database Dr Dave » Spam Karma 2.0 HaloScan.com - Weblog

Commenting and

Commenting and

Trackback Bad Behavior -10 ERROR Dr Dave » Spam Karma 2.0 The WRC Theme Viewer WordPress Multiuser

WnrHPrPcc Hi lirttan«; fni mHp

Trackback Bad Behavior -10 ERROR Dr Dave » Spam Karma 2.0 The WRC Theme Viewer WordPress Multiuser WordPress Quicktags Guide

Figure 16-14. The site admin and logout links

Figure 16-13. The register and login links

Figure 16-14. The site admin and logout links

Blogging For Maximum Profit

Blogging For Maximum Profit

Working Hard, Working Smart or Both; Without The Right Plan, You're Working For Less Than You Could Be! Do You Have A Plan For Making Some Serious Cash With Your Blog NOW? Then download Blogging For Maximum Profits.

Get My Free Ebook


Post a comment