Forum Moderators: rogerd & travelin cat

Message Too Old, No Replies

Wrapping Wordpress with my own custom header / footer

         

csdude55

12:33 am on Mar 23, 2018 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I've been thinking about offering free websites to local businesses, with the condition that I have my own leaderboard at at the top and bottom of the page. It would likely be a simple PHP script to include a separate page so that I can either use Adsense or sell my own local ads.

I would like for them to have total access to the CMS otherwise, but I don't want them to have the option of removing my PHP script.

Any thoughts?

I've read (but not tested) that I could put this in their .htaccess:

# Prepend the file
php_value auto_prepend_file "/dir/path/top_banner.php"

# Append file to bottom of page
php_value auto_append_file "/dir/path/bottom_banner.php"


But there are a few problems with that:

1. Does WP overwrite the existing .htaccess?

2. Wouldn't this attach the files before <html> and after </html>, meaning it wouldn't have the right layout?

I also thought about creating a different default index page with my banner at the top and bottom, then including index.php in the middle. Something like:

<?php

// use cURL to fetch index.php
// rip everything before <body

echo $everything_before_body;

include "/dir/path/top_banner.php";

echo $everything_after_body;

include "/dir/path/bottom_banner.php";

?>


That would only work on the homepage, and it might be kinda slow, but it does solve the other two concerns.

So before I go that route, can you guys suggest an alternative?

not2easy

1:09 am on Mar 23, 2018 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



WP core would overwrite everything on each update. Updates are frequent and it just doesn't work that way. Download a copy and look at the package. You'd be better off using WP multi-user and creating a proprietary theme. Offer child themes to users. :)

TorontoBoy

1:09 am on Mar 23, 2018 (gmt 0)

5+ Year Member Top Contributors Of The Month



Offer custom hacked themes with your banner on header/footer. It would render your banner on every page every time. You could offer multiple themes. Hacking a WP theme is pretty easy, just make it a child theme, change the header.php and footer.php, or something like that. Different themes have different names. They could change all the theme options, but not your code.This would not work if they downloaded and switched to the new theme.

WP multi-user is a great idea. That would work with hacked child themes.

I'm not sure about the free part of your plan. WP takes time, effort, is prone to hacking. I want to get paid for my work, and I'm sure you do too.