Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Im trying add a credit link to the footer of all the WP sites i make saying:

Designed by ...

While this is simple enough, i want to code it so that if this link is removed from the footer, the entire site shows an error or doesn't load up etc.

Any one have ideas?

share|improve this question
6  
This is unethical and annoying. If you have to force your users to show the link your product isn’t worth being used. Build great themes or plugins and make people proud to use it. –  toscho Oct 16 '12 at 11:11
    
its not the clients removing it, after i sell the product(sites) larger web companies are hosting the site for them and changing the "Designed by" to their own site which is unethical. I'm a small company and i get work from these referral links. Effectively its the same as using the free version of typekit and being forced to display their link. so please dont start to assume my products are not great. –  Matt Oct 16 '12 at 11:39
3  
Creative work is copyright, if you consider they are in effecting stealing your work, use the law based on your licensing, as Toscho said forcing people won't do anything, if you can code it, then people can remove it. –  Wyck Oct 16 '12 at 12:40
1  
Reupvoted your question. I don't like what you want to do, but I like your heliskiing avatar. :) –  kaiser Oct 16 '12 at 17:11
add comment

1 Answer 1

up vote 1 down vote accepted

While I believe the premise of this to be flawed and somewhat black-hat, it is a legit WP question albeit a futile exercise.

You can do something like the following:

add_action('template_redirect', 'foobar_explode_if_no_citation');
function foobar_explode_if_no_citation(){

    #Get the absolute server path to footer.php
    $footer_path = locate_template('footer.php');

    #Store the footer file contents in a var
    $footer_contents = file_get_contents($footer_path);

    #The required string
    $citation_string = 'Designed by Foo Bar';

    #Set off the nuclear bomb if there is an egregious offense
    if(!preg_match("/$citation_string/", $footer_contents))
        exit('All your websitez are belong to me. Make sure this string "Designed by Foo Bar" is included in footer.php');
}

I hope you get my tongue-in-cheek innuendoes regarding what a bad user experience this would be. :)

Caveat

As noted in the comments, there are innumerable ways to route this approach, and any approach for that matter. Anyone can easily reverse engineer any mechanism put in place.

share|improve this answer
2  
<!-- Designed by Foo Bar --> –  toscho Oct 16 '12 at 17:16
    
@toscho Yes, this code will need to account for all shenanigans. –  Brian Fegter Oct 16 '12 at 17:41
    
You don’t even know if the plain footer.php will be used by the theme. :) get_footer( 'rebranded' ); –  toscho Oct 17 '12 at 23:29
    
@toscho I mainly created this as a proof-of-concept. I realize there are a gazillion ways to get around this. My answer was mainly to show what a nightmare this would actually be to accomplish something like this. Hence, my tongue-in-cheek reference. This whole concept is not maintainable at all. –  Brian Fegter Oct 18 '12 at 2:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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