Posts Tagged ‘WordPress’

Web Building With WordPress

How much time can you spare per day to build and maintain your web?

And if you have several tasks going on at the same time, which is the more important?
With just that “much time” available, and when you rebuilding a web and maintaining others at the same time, which is the more urgent?

Halting Make Your Own Web Site

I usually work on several pages at the same time on my laptop, and upload them to the server together when they are ready.
There are about 11 pages written and just as I was into the editing and rewriting, something else popped up.
(more…)

Validating WordPress Single Post

Error Line 117, Column 95: there is no attribute “aria-required”

…me=”author” id=”author” value=”" size=”22″ tabindex=”1″ aria-required=’true’ />

Ever since this line was in the comments.php, my blog no longer validates.
I have always ignored it.
If it benefits the visitors, I’ll live with it.

But suddenly, this Invalid Markup bothers me today. It must have been 2 years.
Someone must have moved too fast and someone else moved too slow.
2 years and still behind. It must be a case of :

  • It is not important
  • It is important but is not urgent
  • It is important and urgent but does not required immediate attention and action

So I opened up comment.php and search for <aria-required> I found these 2 lines:

<p><input type="text" name="author" id="author" value="<?php echo esc_attr($comment_author); ?>" size="22" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> />
<label for="author"><small>Name <?php if ($req) echo "(required)"; ?></small></label></p>
<p><input type="text" name="email" id="email" value="<?php echo esc_attr($comment_author_email); ?>" size="22" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> />
<label for="email"><small>Mail (will not be published) <?php if ($req) echo "(required)"; ?></small></label></p>

I had these 2 lines of php code removed

<?php if ($req) echo "aria-required='true'"; ?>

Now there’s a line that says
<?php if ($req) echo "(required)"; ?>

I don’t understand PHP but I feel this line should go too.

Since it’s done, I’ll go fill in a comment and see if there’s anything wrong.

It’s good the see this line again:

This document was successfully checked as XHTML 1.0 Transitional!

WordPress Category Template

Much of designing time were spent on the header of this template.

The horizontal navigation is on the header and I want both the web and the blog’s header to look exactly alike.

Since the web’s header is done, what next is to customize the blog’s header.

Method 1 – Default

By default, WordPress uses archive.php for all categories archive.
But I won’t be able to achieve the same effect as the web’s header.

Over at the website, I could include a different header for each category.
By having a different color and having the underline and link removed, the visitors would know which category they are at.

Method 2 – Customize

With WordPress, it’s something I’ve never done before.

I read the Category Template of the WordPress documentation and other related docs to have an idea on how I could achieve this.

2 things to do:

  • Find out the ID of each category
  • Create a template for each category

WordPress Version 2.9 allows the use of category-slug. That means I could create the 4 category files as:

  1. category-create-website.php
  2. category-build-website.php
  3. category-design-website.php
  4. category-promote-website.php

Category-ID

But since I tested the template by naming it category-15.php and it worked, there’s no need to test another method.
To obtain the category id, I just need to log into the admin area and do a mouse over each category created at the category creation area. The id will be reflected on the status bar.

With the category id on hand, I copied everything from archive.php and saved them as:

  • category-15.php
  • category-16.php
  • category-17.php
  • category-18.php

The effect of “here” is done over at the header file.
I could save 4 header files, each for a category and include the header from the category file:

<?php include (TEMPLATEPATH . '/header-create.php'); ?>

The other method is to copy all the codes from the header file and paste them onto each category template file.

This is the only part on the header I need to edit for each category template to achieve the similar effect as the web’s horizontal menu.

Like for create-website category, this is how it would look like:

<div id="head-menu1">
<div id="t1">
<ul>
<li><a href="http://www.starising.com">Web</a></li>
<li class="heret1">Make Your Own Website</li>
<li id="t11"><a href="http://starising.net">Blog</a></li>
</ul></div>
<div id="t2"><ul>
<li class="here">Create Website</li>
<li><a href="http://starising.net/category/build-website/">Build Website</a></li>
<li><a href="http://starising.net/category/design-website/">Design Website</a></li>
<li><a href="http://starising.net/category/promote-website/">Promote Website</a></li>
</ul></div>
</div>

Category Template Done

If you are new to WordPresss template, you may not be able to understand this.
I’ll explain further in details when I touch on designing a WordPress template.

This post serves as a record of what I’ve done to achieve this effect.
I remember better if I succeeded only after a few attempts.
Sometimes, a lucky one-time-through saves time, but we didn’t learn much.

Without this record, months later, I’d be asking myself, “How did I do that?”

New Kid On The Blog

This is the fourth posting of this blog.

2 of the 3 previous posts appeared under the domain search but not under the title search in Google, Yahoo and Bing.

In fact they appeared in Google an hour after publishing the post.

If you are using the regular WordPress, it should even be faster.
I had postings on standard WordPress that were captured by Google within 15 minutes.

I am using WPMU and it’s much slower. It usually takes up to an hour.
I am not complaining on that.

All pages under the web have yet to show up.

Linking Strategy

The lesson here – If it’s a new website or a website on a new domain, it may take some time to be crawled.

Since the search engines come to the blog first though I created the web earlier, the strategy is to link the web from the blog.
This may speed up the process.
Also need to create a RSS file for the website.

While writing this, I suddenly remembered I have an unattended blog over at WordPress.com.

New website, new blog, new postings – with everything being equal – the weight should be on a more popular domain – WordPress.com.

Time to go over and do some postings at starising.wordpress.com

Custom Home Page for WordPress

By default, WordPress calls the index.php as the home page.

To override the default, I use the home.php instead.

Index.php and Home.php – which is better?

I can’t tell which made a better home; to me it’s a matter of preference.

When using the index file as the home page, I usually set posting to 3 so that it will not stretch too deep down making reading difficult and loading slower.

Or if I remembered to insert “more” to the posting, then maybe 5 to 7 postings per page would provide a quick glance for any first-time visitors.

Using home.php allows me to customize it to anyway I like without affecting the rest of the template.

As in this case, I want the home page to adopt the 1-column look so that it is identical to the web, while the rest of the blog’s files I could have a 2-column template.

I am not sure if it’s alright to leave index.php in the folder.

Can index.php and home.php coexist? I really have no idea.

But having index.php in the folder serves as a backup in case other files needed are not present.

Page Title

The home page displays the blog whereas the single file displays the post title.

While I love the way the blog is being displayed, I would prefer the title to show my Site Concept Keyword – Make Your Own Website.

In order to effect this change, this is what I did to the header.php

I changed the default line of:

<title><php wp_title('«', true, 'right'); ?> <php bloginfo('name'); ?></title>

to :

<title>Starising - Make Your Own WebSite</title>

In short, it means removing the php code and manually insert a title of my choice to the title element.

Having done that, I can no longer named this header.php or every page will display the same title.
So I named this header-home.php

And over at home.php I changed the include code:

<?php get_header(); ?>

to

<?php include (TEMPLATEPATH . '/header-home.php'); ?>

header-home.php

So now I have a new file with only 1 line changed.
Is it worth the effort? Not now…

At a later stage, I would be able to make other changes to the header of the home page especially the setting for the horizontal menu at the header bar.