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:
1 2 3 4 5 6 7 |
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"> <?php the_title(); ?></a></h2> <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small> <div class="entry"> <?php the_content('Read the rest of this entry »'); ?> </div> |
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:
1 |
<link rel="shortcut icon" href="<?php bloginfo('template_directory'); ?>/favicon.ico" /> |
1 2 3 4 5 |
// check if the post has a Post Thumbnail assigned to it. if ( has_post_thumbnail() ) { the_post_thumbnail(); } the_content(); |
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):
1 2 3 4 5 6 7 8 |
<h2> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"> <?php the_title(); ?></a> </h2> <small> <?php the_time('F jS, Y') ?> by <?php the_author() ?> </small> |
1 2 3 4 5 6 7 8 |
<h2> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"> <?php the_time('F jS, Y') ?> - <?php the_title(); ?></a> </h2> <small> by <?php the_author() ?> </small> |
In some cases it may be necessary to change sidebar.php.
1 2 3 4 5 |
<h2>Categories</h2> <form action="<?php bloginfo('url'); ?>" method="get"> <?php wp_dropdown_categories('show_count=1&hierarchical=1'); ?> <input type="submit" name="submit" value="view" /> </form> |
Put this code into your index.php where you wish the item to appear:
1 2 3 4 5 6 7 8 9 10 11 |
<li id="archives">Archives: <ul> <li><form name="archiveform" action=""> <select name="archive_chrono" onchange="window.location = (document.forms.archiveform.archive_chrono[document.forms.archiveform.archive_chrono.selectedIndex].value);"> <option value=''>By Month</option> < ?php get_archives('','','option', 1); ?> </></select> </form> </li> </ul></li> |
Create a file called wp-content/themes/default/pageofposts.php that has this code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
<?php /* Template Name: PageOfPosts */ get_header(); ?> <div id="content" class="narrowcolumn"> <?php $showposts = -1; // -1 shows all posts $do_not_show_stickies = 1; // 0 to show stickies $args=array( 'showposts' => $showposts, 'caller_get_posts' => $do_not_show_stickies, ); $my_query = new WP_Query($args); ?> <?php if( $my_query->have_posts() ) : ?> <?php while ($my_query->have_posts()) : $my_query->the_post(); ?> <?php //necessary to show the tags global $wp_query; $wp_query->in_the_loop = true; ?> <div <?php post_class() ?> id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2> <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small> <div class="entry"> <?php the_content('Read the rest of this entry »'); ?> </div> <p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p> </div> <?php endwhile; ?> <div class="navigation"> <div class="alignleft"><?php next_posts_link('« Older Entries') ?></div> <div class="alignright"><?php previous_posts_link('Newer Entries »') ?></div> </div> <?php else : ?> <h2 class="center">Not Found</h2> <p class="center">Sorry, but you are looking for something that isn't here.</p> <?php get_search_form(); ?> <?php endif; ?> </div> <?php get_sidebar(); ?> <?php get_footer(); ?> |
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:
1 2 3 4 5 6 |
#fp:first-letter { font-size : 300%; font-weight : bold; float : left; margin-right: 3px; } |
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.
Article Tags: CSS, Tip and tricks, wordpress, wordpress beginners, wordpress tutorils, wpbeginner, wpbeginners