Before I get bombarded with RTMs, I did google this, but all I got was tutorials on how to install themes.
I have to change a link for a friend’s website. Normally I would just ssh into the server issue the command vim index.html and change the <a href='this.html'>This<\a> to
<a href='that.html'>That<\a>, but wordpress is really doing my head in. Changing the link in the index.html file has no affect, and furthermore I can tell that there are some differences that lead me to believe that it is not being used at all
So the first thing I looked at is the .htaccess file:
DirectoryIndex index.php index.html
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Next I looked at the index.php file:
<?php
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/
/**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
define('WP_USE_THEMES', true);
/** Loads the WordPress Environment and Template */
require('./wp-blog-header.php');
So next I went to wp-blog-header.php then wp-config.php then I just gave up.
What I want to know is what exactly wordpress templates do. Do they just set up some of the CSS code and make it easier to link to blogs and facebook? What I was looking for was something in the wordpress Dashboard resembling this:
Main Page = index.html
But nothing like that exists. There is, under the pages tab a “home” page, and that definitely is the “home page” I enter, but the html code displayed for it in WordPress does not match the HTML code when I click “view page source”. So where exactly is this new code being generated? I need to intercept it somehow and change the link.
WordPress themes are based on template files which are loaded automatically depending on the content. There are lots of different possibilities, but generally speaking the index.php is what is called for all requests, and then loads the appropriate template files. The files will be located in
wp-content/themes/YOURTHEMEheader.phpis called from most pages and defines the top part of the templatefooter.phpis called from most pages and defines the bottom part of the templatepage.phpdefines the content section for “page” post typescategory.phpdefines the content section for “categories”Other files may define custom templates which are then used for particular pages by selecting that template on the right side of the page editor in the WordPress Admin.
You can find more info on WordPress theme templates here: http://codex.wordpress.org/Template_Hierarchy