Today I would like to mention about some php commands required for making a wordpress site. Creating a Wordpress template is not that much hard unless you know some basic php. I initially thought of making a step by step video tutorial on this. But due to the lack of time and some other limitation I decided to make it short. I will teach you some basic php, but before that I am giving the complete list of files
Don't worry. you just need to make a blank file with that name
PHP - Hypertext Preprocessor
File Extensions The usual web server configuration is that somefile.php will be interpreted by PHP,
whereas somefile.html will be passed straight through to the web
browser, without PHP getting involved.
The <?php tag tells PHP that everything that
follows is program code rather than HTML, until the closing ?> tag
Variables containers in which values can be stored and later retrieved are a fundamental building block of any programming language.
For instance, you could have a variable called number
that holds the value 5 or a variable called name that holds
the value Chris. The following PHP code declares variables with those
names and values:
$number = 5;
Arguments and Return Values
Every function call consists of the function name followed by a list of arguments in parentheses. If there is more than one argument, the list items are separated with commas. Some functions do not require any arguments at all, but a pair of parentheses is still requiredeven if there are no arguments contained in them.
The built-in function phpinfo generates a web page that contains a lot of information about the PHP module. This function does not require any arguments, so it can be called from a script that is as simple as
If you create this script and point a web browser at it, you will see a web page that contains system information and configuration settings.
Now its time for wordpress
Wordpress has a set of built-in functions and arguments. All we have to do is use these. This is a short tutorial and I will keep everything short.
<?php bloginfo('name'); ?>
Display the name (title) of the blog. This command calls for the argument name in the function bloginfo. The blog name is nothing but what you have as Weblog title from the wordpress. This can be inserted between <title><title/> tags.
<?php bloginfo('url'); ?>
This one displays the url of the blog. Here also "bloginfo" is the function. This command calls the argument "url" in the function "bloginfo".
<?php bloginfo('description') ?>
This displays the caption of the blog. In default, its result will be "Just another wordpress blog".
<?php have_posts() ?>
It checks to see if you have any post.
<?php the_post() ?>
Calls for the posts.
<?php the_title(); ?>
This function calls the title of the current blog post.
<?php the_permalink(); ?>
This function that calls for the address or location of each post.
<?php the_content(); ?>
It displays the post
<?php _e('Filed under:'); ?>
It is the code to call for a colon ":"
<?php the_category(', ‘); ?>
the_category() is the PHP function that calls for all the categories that you tagged your post with. If you put Filed under: and the_category() together. You'd get Filed under: Name of category 1, Name of category 2. The comma within the_category() is a way of separating the category names.
<?php _e('by'); ?>
same as Filed under:. If you're creating the theme for personal use, wrapping _e() around the word by isn't necessary.
<?php the_author(); ?>
self explanatory. It simply prints your name or whoever published the post.
<?php comments_popup_link('No Comments »', ‘1 Comment »', ‘% Comments »'); ?>
comments_popup_link() calls for a pop up window of your comments, when popup comment is activated. If popup comment isn't activated, comments_popup_link() simply send you to the list of comments. No Comments » is what will be displayed when you have no comments. 1 Comment » is when you have exactly one comment. % Comments &187; is for when you have more than one comment. For example: 8 Comments ». The percent sign % means number. » is a code to display a double arrow.
<?php edit_post_link('Edit', ‘ | ‘, "); ?>
This is only visible when you are logged in as an administrator. edit_post_link() simply displays an edit link for you to select which post to edit, instead of having to browse through all the posts from the administration panel to search for the one you want to edit. edit_post_link() has three sets of single quotes. The first set is for what word you will use for the link title of the edit link. If you use Edit post, then it'll say Edit post instead of Edit. The second set of single quotes is for whatever that comes before the link. In this case, a vertical line |; that's what the &124; code is for. The third set of single quotes is for whatever that you want to come after the edit link. In this case, nothing comes after it.
<?php posts_nav_link(); ?>
At the bottom of most WordPress blogs, there's a Next Page or Previous Page link. You call for those links by using the posts_nav_link() function of the WordPress template system.
<?php wp_list_cats('sort_column=name&optioncount=1&hierarchical=0′); ?>
This function calls for the list of categories to be displayed. You can further customize them using the following arguments.
- sort_column=name - list category links alphabetically
- optioncount=1 - display the number of posts made under each category
- hierarchial=0 - don't turn sub-categories into sub-list-items, which explains why my Sub Category link is listed in the first level of the list.
- & - each time you add on another attribute, you have to type & before it to separate it from the existing attributes. For example & sits in between sort_column and optioncount.
<?php wp_list_pages(); ?>
This function generates the full list of links for all pages.
<?php wp_get_archives('type=monthly'); ?>
This function call for archive links by month, nest each. Here, "month" is the argument.
<?php get_links_list(); ?>
Add your blogroll links to the your blog.
Thats all for now folks.