Using Categories and Tags as Keywords in Font

Creator USS Code 39 in Font Using Categories and Tags as Keywords

Using Categories and Tags as Keywords
Printing ANSI/AIM Code 39 In None
Using Barcode maker for Font Control to generate, create ANSI/AIM Code 39 image in Font applications.
www.OnBarcode.com
Code 3/9 Maker In None
Using Barcode creator for Font Control to generate, create Code39 image in Font applications.
www.OnBarcode.com
If you need to add meta keywords to your single post archive template, you have all the data you need: your categories and tags. All you have to do is get a combined list, separated by commas. In this example, you first use a conditional tag to make sure this code is used only on single post archives. (Pages don t have categories or tags, and the get_the_tags() and get_the_category() functions won t work correctly on archive pages containing multiple posts.) Then, for each tag and category, you force the name to all lowercase and add it to an array of keywords. As you print the <meta> tag, you remove duplicates from the array with array_unique() and convert the array to a comma-separated string using implode(). Listing 7-16 shows how to build the array of keywords and print it as the content of the <meta> tag. Listing 7-16. Creating meta keywords tag from post categories and tags in header.php < php if (is_single()) { foreach((get_the_tags()) as $tag) { $keywords[] = strtolower($tag->name); } foreach((get_the_category()) as $category) { $keywords[] = strtolower($category->cat_name); } > <meta name="keywords" content="< php echo implode(", ", array_unique($keywords)); >" /> < php } >
UPC Symbol Creator In None
Using Barcode creator for Font Control to generate, create GS1 - 12 image in Font applications.
www.OnBarcode.com
Generating PDF-417 2d Barcode In None
Using Barcode generation for Font Control to generate, create PDF-417 2d barcode image in Font applications.
www.OnBarcode.com
CREATING AN ADVANCED THEME
Make Barcode In None
Using Barcode encoder for Font Control to generate, create Barcode image in Font applications.
www.OnBarcode.com
Creating Code 128 Code Set C In None
Using Barcode generator for Font Control to generate, create Code-128 image in Font applications.
www.OnBarcode.com
Using the Excerpt as a Description
EAN 13 Creator In None
Using Barcode creator for Font Control to generate, create GS1 - 13 image in Font applications.
www.OnBarcode.com
Code11 Encoder In None
Using Barcode maker for Font Control to generate, create USD - 8 image in Font applications.
www.OnBarcode.com
Listing 7-17 shows how to use the excerpt as the meta description tag for single posts and pages. Since the_excerpt() prints directly to the screen and can t be passed to other PHP functions, you can t wrap it in the esc_attr() function, as you normally would when using a template tag as an HTML attribute. Instead, you use the_excerpt_rss(). This function formats the excerpt for RSS feeds, but in this case it will work equally well in your description attribute, since excerpts can t contain HTML. Listing 7-17. Using the_excerpt as a meta description < php if (is_singular()): global $post; setup_postdata($post); > <meta name="description" content="< php the_excerpt_rss(); >" /> < php endif; >
Painting Code 39 Extended In C#
Using Barcode creator for .NET Control to generate, create Code39 image in .NET framework applications.
www.OnBarcode.com
Drawing ANSI/AIM Code 39 In None
Using Barcode creation for Office Excel Control to generate, create Code 39 Full ASCII image in Microsoft Excel applications.
www.OnBarcode.com
Short Links and Canonical URLs
Encode EAN / UCC - 14 In Java
Using Barcode creator for Eclipse BIRT Control to generate, create USS-128 image in BIRT reports applications.
www.OnBarcode.com
EAN13 Generator In .NET Framework
Using Barcode drawer for VS .NET Control to generate, create UPC - 13 image in VS .NET applications.
www.OnBarcode.com
Those long URLs containing your post titles are great for improving your search results, but they re awfully long! If you re sharing links on social media networks, e-mailing them, or including them in printed documents, you re probably interested in ways to shorten your links. The default permalink structure always works, even if you ve changed your permalinks to some other structure. Listing 7-18 shows how to include the default permalink in your Loop using the new the_shortcode() tag in 3.0, the results of which are shown in Figure 7-6. If you have installed the WordPress.com Stats plugin, you can take advantage of the wp.me link shortener feature. There are a number of other link shortener plugins you can install if neither of these appeals to you. Listing 7-18. Displaying the default permalink in a Loop < php if (have_posts()) : while (have_posts()) : the_post(); > <h2><a href="< php the_permalink(); >" title="< php the_title_attribute(); >">< php the_title(); ></a> </h2> < php the_content(); > <p>Sharing this post < php the_shortlink(); ></p> < php endif; >
Barcode Scanner In Java
Using Barcode recognizer for Java Control to read, scan read, scan image in Java applications.
www.OnBarcode.com
Generating Barcode In Visual Studio .NET
Using Barcode creator for ASP.NET Control to generate, create Barcode image in ASP.NET applications.
www.OnBarcode.com
CREATING AN ADVANCED THEME
PDF-417 2d Barcode Printer In Visual Basic .NET
Using Barcode encoder for .NET framework Control to generate, create PDF-417 2d barcode image in Visual Studio .NET applications.
www.OnBarcode.com
Barcode Printer In None
Using Barcode encoder for Software Control to generate, create Barcode image in Software applications.
www.OnBarcode.com
Figure 7-6. the_shortcode() in the post footer Google sometimes penalizes sites for duplicating content. However, a single post on your WordPress site might appear on the home page, a date-based archive, a category archive, and the single post archive. It might also have three or four valid URLs if you re using a short link format. To resolve the duplicate content problem, Google recommends that you specify a canonical URL for each post its home base, where all the archived copies will lead. As of version 2.9, WordPress automatically adds a canonical URL header as part of the wp_head() function. As of 3.0, it also adds the shortlink, as shown in Listing 7-19. Listing 7-19. Canonical and shortlinks in the <head> section <link rel='canonical' href='http://wordpress/2008/09/layout-test/' /> <link rel='shortlink' href='http://wordpress/ p=188' />
Drawing Code128 In Visual Studio .NET
Using Barcode generation for ASP.NET Control to generate, create Code 128 Code Set B image in ASP.NET applications.
www.OnBarcode.com
Creating Linear In C#.NET
Using Barcode maker for VS .NET Control to generate, create Linear 1D Barcode image in .NET framework applications.
www.OnBarcode.com
QR Code Reader In VB.NET
Using Barcode decoder for Visual Studio .NET Control to read, scan read, scan image in .NET framework applications.
www.OnBarcode.com
Encoding Barcode In Objective-C
Using Barcode generation for iPhone Control to generate, create Barcode image in iPhone applications.
www.OnBarcode.com
Copyright © OnBarcode.com . All rights reserved.