wordpress-snippets

1. How do I show only the titles of articles on the site homepage?

To show only the title of posts on the site homepage, using the WordPress Default theme as an example,
in the wp-content/themes/default/index.php file you will find code similar to this:

2. How to add a favicon to your site?

Add a favicon to your site in WordPress 2.0 or later, place your favicon.ico file
inside your theme folder (for example: wp-content/themes/default/) then add this line to header.php:

3. How can I display images in my category and archive pages?

4. How can I have the date/time displayed on every entry I make?

To put the date and time on every post title on your site, you may have to change more than one template file. They may include index.php, single.php, category.php, and archives.php.

From among the various template files, find all references to the title of your post like this (your Theme version may be slightly different):

5. Rearrange it so the time information goes in front (or in back) of your Post Title:

6. How do I make my categories appear in a drop down list ?

In some cases it may be necessary to change sidebar.php.

7. How do I make my Archives appear in a drop-down list?

Put this code into your index.php where you wish the item to appear:

8. How to display posts in a Page?

Create a file called wp-content/themes/default/pageofposts.php that has this code:

9. How do you create a screenshot.png for your Theme?

  • Create a screenshot image using the Print Screen button on your keyboard and pasting it into your graphics program, or use the screen capture feature found in many popular graphics programs.
  • Resize the image to 300×225 pixels.
  • Save the image as a PNG file in your Theme’s folder with the name screenshot.png. WordPress looks for that file name automatically.

10. How do I do a dropcaps on the first letter of a post?

DropCaps is the name for the effect where the first letter of the first paragraph in an article drops below the line of text, and is displayed in a larger font-size than the other normal letters.

This can be done using BBCode quicktags. First, add this to your style sheet: