Understand WordPress tags

WordPress template tags

Like most newbie, before I start develop WordPress theme from scratch, I started with getting a framework from others, and apply design to it. Though it saved a few hours of my time cracking my head knowing how the tags works. Until the day I found and understand how understand WordPress tags from its template tags page, I keep referring back from time to time.

WordPress tags
At first, I was quite confused with all the writing and PHP array it has in there. After a long time, it is actually quite simple to understand and apply. Read on the page, it will explain how each array means and how it work.

It may be confusing when it written:

<? php $defaults = array( 'menu'=>'Main Menu', 'container'=>'div', 'container_class'=>, 'container_id'=>, 'menu_class'=>'menu', 'menu_id'=>, 'echo'=>true, 'fallback_cb'=>'wp_page_menu', 'before'=>'<span>', 'after'=>'</span>', 'link_before'=>'<span>', 'link_after'=>'</span>', 'depth'=>0, 'walker'=>, 'theme_location'=>'theme'); ?>

Scroll down the page, it will explain everything in details :) Just slow and easy, don’t get too rush or you may get frustrated.

Like all CMS may have – Limitation. Unless you are building your own CMS system, you may have some obstacle when you want some function that doesn’t have in WordPress. Of course, before you think about plugins, you may consider looking into their function reference. There are lots of way to twist a function to fit your need.

Make WordPress SEO friendlier

Just a quick question…

If meta keywords were built for SEO friendly, why the default WordPress theme comes with no meta description and meta keyword?
Wordpress default theme
Well, probably a lot of user added meta description and meta keywords themselves, but that’s all. It all fixed and not change-able. I recently look into the WP template tags, which has this get_the_tags function.

So I got into the default theme, add in this:

<meta name="keywords" content="
Check if it is on single.php
<?php if (is_single()){ ?>
If it's on single.php, show the tags of the entry
<?php $posttags = get_the_tags();if ($posttags) {foreach($posttags as $tag) {echo $tag->name . ', '; }}?>
If not on single.php it shows these keywords.
<?php } else { ?>
My, own, fixed, keywords
<?php } ?>"
/>

Now you have different meta keywords on different entry, and the keyword is according to your post tags :)