I am very news in WordPress world and I am finding some difficulties with creation of a personal template.

I want implement a blog like this one (that is using WordPress): http://viralpatel.net/blogs/

My blog have to be simplest and there must be only two columns: one for the last posts and one for the most visited posts.

I started from an existing template (named Coogee) and have divided the content area (the index.php file) into two columns: the first one shows the new posts and the second one shows the most read posts.

I have implement this features with some lines of code that I have put in my columns as show here: http://bacsoftwareconsulting.com/blog/index.php/wordpress-cat/how-to-display-most-viewed-posts-in-wordpress-without-a-plugin/

Ok, now the homepage look good for my intents but I am having some problem in the categories page.

For example if you click on the "generic" link on Category menu in the side bar you obtain this page: http://scorejava.com/wordpress351/?cat=2

In theory this page should show ONLY the articles that have the "generic" category but this is not true. In fact, in the left column are correctly showed the articles having "generic" category but in the right column still remain the last 5 posted articles...

And now I have a question...seems that WordPress use this index.php file as template of the content area of all page (except the one that displays a single article that uses single.php file)

This is not good for me because I want that a category page show only one big column with the last articles of the current category, as here: http://viralpatel.net/blogs/category/spring/spring3-mvc-framework/

As you can see in this blog there is more columns in the homepage but only one column for the category page

Is there a way to define an other structure (different from the index.php file used for the homepage articles content) for the categories page?

If I can't use an other structure for the categories page and consequently I have to use the same index.php file also per the categories content page....there is a way to show the second column only if the visitor is in the homepage and don't show it if he is in a category page (do not show it if the visitor is in a pge like: http://scorejava.com/wordpress351/?cat=2

1 Answer 1


If I understand you...

Your theme may only have an index.php and a single.php but WordPress supports a much more complicated templating system, and you can control the formatting of different types of content just by creating files with the right names. In your case, I think that at least one of the files you need is category.php.

Of course, you will have to write the appropriate PHP for that template but you should be able to copy either your index.php or your single.php to get started.

  • Meanwhile, thanks for your explanation. I have do a quick look of what you link to me. Are you maybe saying me that if I implement my visualization logic into index.php file so this presentation logic will be used both for the homepage rendering but also for the category page rendering? and that I can change this behavior put the presentation logic for the homepage in a specific file (for example front-page.php) and the presentation logic for my category view in some other file (category.php) Have I understand or am I missing something? Tnx Commented Mar 21, 2013 at 23:26
  • I think you are on the right track. Please look over the templating system very carefully. Different .php files are used for different content types, if the appropriate .php files are present in the theme.
    – s_ha_dum
    Commented Mar 21, 2013 at 23:31
  • ok, tomorrow I will study it in the details. Only a last question about it: and if, as in my case, some .php file are not present? (for example in my template front-page.php are not present) Can I simply create it or I have to do more complex operation? Commented Mar 21, 2013 at 23:37
  • Yes, just create the file you need. If it is named correctly it will be used automatically-- auto-magically :)
    – s_ha_dum
    Commented Mar 21, 2013 at 23:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.