Until recently, I have used a default wordpress theme which historically is a bit old and used to be a default theme to the older versions of wordpress.
Since however, I’ve went to many updates and on the other hand I do like and enjoy the template I have decided to continue use it for my blog until this very day.
However this nice theme’s default behaviour is a bit weird, since by default the Single opened posts are configured in a way that the usual index page sidebar is missing.
As in the sidebar there are plenty of navigation buttons and search in the blog button, at a certain moment I have realized it’s probably not a good idea that the single.php (single blog posts) open up with the right sidebar missing.
Thus I’ve decided to put back the missing sidebar in the single posts, with a hope that this will be helpful to my readers and hence have positive impact on the overall blog user experience.
Doing so prooved to be rather easy, here is how I added back the right sidebar to my wordpress single posts :
1. Edit blog/wp-content/themes/default/single.php
debian:~# vim /var/www/blog/wp-content/themes/default/single.php
2. In the single.php look up for the code:
<div id="content" class="widecolumn">
Substitute this html code with:
<div id="content" class="narrowcolumn">
3. Next find the code:
<?php get_footer(); ?>
Right before the get_footer(); php function add in the function;
<?php get_sidebar(); ?>
Tadam! Refresh a single post in Firefox and you should see your blog index.php sidebar to show up.
How to change default Comments and No Comments location in WordPress in wordpress default theme
Tuesday, April 5th, 2011For a number of time I’ve been planning to change my blog comments placement. Until this very day however I’ve kept the default wordpress theme’s Comments button placement.
I realize the default Comments button placement is a bit hard to see and not that much intuitive for the user that enters my blog for a first time.
My first guess was that there might be somewhere a wordpress plugin which will allow me to adjust my comments button placement.
After some research online and a realization that probably there is no such plugin existing yet. I’ve forced myself to tune it up myself.
It was clear to me that in order to change the it will be necessery to edit the WordPress templates files. I’m not a designer and when I hear about templates I usually get scared, however I took the time to take a look at the default wordpress template and find out actually that template modifications is actually rather easier than I thought.
My previous idea was that in order to edit templates you have to be some kind of CSS and HTML guru (which I’m not). Nevertheless it seems that in order to play and adjust in a good way the templates you don’t need ot be a pro.
Even an uneducated fool like myself can easily do almost everything he thinks of throughout few lines of code in the wp templates.
To get back to the major topic thanks God after a bit of review and reading of wordpress.org documentation and some user forums. I’ve figured out that in order to change my Comments placement you need to modify the file:
In index.php find the line starting with:
You will notice within this opened paragraph the php code:
<?php the_tags('Tags: ', ', ', '
'); ?> Posted in <?php the_category(', ') ?>
| <?php edit_post_link('Edit', '', ' | '); ?>
<?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>
This is the actual default theme php code that makes the wordpress Comments or No Comments that maes the comments appear on the blog.
Now I’ve decided to let this be as it is but add one more Comment button to wordpress on a different location that is more appealing to my blog visitors
After quick evaluation I’ve determined that probably the best location that the Comments button should have is right after the end of the post text
If you think my idea for button placement is appropriate, to set this location for the Comments button, you will have to find the follwoing code in index.php:
<div class="entry">
<?php the_content('Read the rest of this entry »'); ?>
</div>
Right after the end of this code place the following code:
<?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>
</div>
Tags: amp, Auto, blog, Button, button placement, code lt, Comment, content themes, CSS, default theme, Draft, everything, file, fool, god, guess, guru, HTML, idea, index, kind, line, link, location, lt, nbsp, necessery, online, order, org, paragraph, php, php code, place, placement, plugin, quot, reading, realization, right, template, text, textIf, time, topic, way, Wordpress, wordpress plugin, wordpress templates
Posted in Various, Web and CMS, Wordpress | 1 Comment »