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.

I'm a Wordpress Theme Designer. I want to have functions to make my footer links remain intact. Like some themes that use this method to protect their footer link from the theme downloaders to remove it.

If they alter, change, or deltete parts or all, they will get an error! Any step by step guide or source would really appreciated!

Thanks so much!

Regards,

Thy

share|improve this question
add comment

2 Answers 2

up vote 2 down vote accepted

If you are releasing a GPL'd theme (which WP requires, but not looking to start the whole GPL debate here) then you can't prevent someone from removing your footer link. You can ask they they don't do it. But anyone who's looking to do so will get around whatever method you employ.

a side note: having these links in the footer may be more of a bad thing than good. I'd suggest reading this article on WPMU about how spammers using their themes caused them to get thrashed in their rankings.

share|improve this answer
add comment

The best way to do this (I don't approve of this method but I this is a different discussion) is to add your footerlink to wp_footer(), like that:

function your_link() {
    echo '<a href="#">Your Link</a>';
}
add_action('wp_footer', 'your_link');

You still don't have any prove that the Link exists and is not deleted. So set a transient in your function:

function your_link() {
    echo '<a href="#">Your Link</a>';
    if ( !get_transient( 'check_my_footer_link' ) {
        set_transient( 'check_my_footer_link', 'is_there', 600 ); //expires after 600 seconds
    }
}
add_action('wp_footer', 'your_link');

Now you have a transient telling you, if the footerlink was called in the last 600 seconds.

The next step would be the message to the user, wherever you want to display the message, or if you want the site to die or whatever. I go with wp_mail() now, because you can use every kind of message to inform the user, from wp_mail to another footernote or anything else.

So, adding the messagefunction to your sites admin panel:

function messagefunction() {
    if ( get_transient( 'check_my_footer_link' ) != "is_there" ) {
        wp_mail( get_bloginfo( 'admin_email' ), 'You deleted the Footer Link', 'Bad Move' );
    }
}

And call this function in the functions.php or any other file from your theme.

This method has a few drawbacks, as it could be that the site was not visited for 600 seconds, so the transient does not exist anymore. You could implement a counter for that (set an incrementing option 'views_of_site_without_footerlink', and just send the message if it is bigger than 1, and set it back to zero if the footer link is displayed).

Remember that it is not 100% safe, beacuse if a developer removes the notification stuff as well, it won't work anymore.

share|improve this answer
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.