Forums

Modified index.php (root) (4 posts)

  1. akensai
    Member
    Posted 1 year ago #

    Alright so I decided to add side images via tables to my blog (if you can call it that.)

    I have been using WordPress for quite awhile, but I'm pretty stuck on this one, thus finally registering a user to ask here on the forums.

    Here is my "test" index:

    <div align="center" style="height:100%;width:100%;">
    	<table border="0" cellspacing="0" cellpadding="0" rules="none">
    		<tr>
    			<td height="500px">
    				<div style="background-image: url(http://imgeasy.com/images/bf3.png); height: 498px; width: 200px; border: 0px;"></div>
    			</td>
    			<td>
    				<?php define('WP_USE_THEMES', true); require('/home/akensaivps/akensai.com/wp-blog-header.php'); ?>
    			</td>
    			<td height="500px">
    				<div style="background-image: url(http://imgeasy.com/images/bf32.png); height: 498px; width: 200px; border: 0px;"></div>
    			</td>
    
    		</tr>
    	</table>
    </div>

    As you can see, I am trying to do the 3-cell table trick for side images, the problem is that WordPress doesn't seem to want to work when the wp-blog-header.php is NOT being called first.

    You can view the test page @ http://akensai.com/test.php

    What happens when this page is set as index.php:
    "Cannot modify header information - headers already sent by (output started at /home/akensaivps/akensai.com/index.php:8) in /home/akensaivps/akensai.com/wp-includes/pluggable.php on line 897"

    styles don't seem to work correctly, aka: text format, font, etc - everything else (background, divs, etc seems to work)

    General links no longer working

    Any insights are appreciated!

  2. Helen Hou-Sandi
    Member
    Posted 1 year ago #

    Why are you doing this to the root index.php?! You should never, ever edit WP core files! </lecture>

    Visual changes should be made in your theme files (wp-content/themes/minimal/ in your case). You definitely shouldn't be using tables to control your layout, and if the images are background images rather than content, they should be in your CSS, not HTML. Your site looks like it's fixed width - you could combine those two images with the requisite amount of space between them and set it as the background image for the body (not repeating, hopefully) or another wrapping div if you're not into CSS3 multiple background images (good but not complete browser support). If you want to test changes, try making a child theme and previewing it or using a plugin to switch themes for you as the admin user.

    Child themes: http://themeshaper.com/2009/04/17/wordpress-child-theme-basics/
    Theme preview plugin: http://wordpress.org/extend/plugins/theme-preview/

    The error itself means that you are sending information to be printed in the browser before WP usually sends header information. Since you list yourself as having advanced PHP and HTML skills, I apologize if I'm telling you something you already know. WordPress can't work as expected unless its core files are loaded properly; in this case by declaring a constant and then requiring the wp-blog-header.php file. Once you start mucking with core files, you set yourself up for... well, errors like that one.

  3. akensai
    Member
    Posted 1 year ago #

    Right, in theory it should work since the only thing altered in the index.php is adding tables. I know it's a bad idea to edit the core files, but its the easiest way to do what I want to do.

  4. Helen Hou-Sandi
    Member
    Posted 1 year ago #

    No, in theory it should not work and it's not easy. The root index.php is not a visual thing at all, it's just a loader file, and you are going to get errors with headers sent if you put output in that file. If you want to change the way your blog looks, you should be altering the template files in the theme folder.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags