Web based solutions, tutorials, examples and help. 

  • [HOW TO] Null FThemes.com Templates

 #103  by Nito
 Tue Mar 22, 2011 2:18 pm
FThemes.com's offers free templates/themes for WordPress. The only thing is, they force backlinks in the footer unless you pay for the theme. I guess it wouldn't be too bad, if it were just their website, but they spam multiple sites in the footer, and that is just not cool.

So today I'm going to teach you how to remove that disgusting, PR stealing code.

Go into the directory of the theme you want to edit, and navigate to /lib/Themater.php.
Open it in your favorite editor and scroll all the way to the bottom.
Three lines from the bottom should like something like this:
Code: Select allif (!empty($_REQUEST["theme_license"])) { wp_initialize_the_theme_message(); exit(); } function wp_initialize_the_theme_message() { if (empty($_REQUEST["theme_license"])) { $theme_license_false = get_bloginfo("url") . "/index.php?theme_license=true"; echo "<meta http-equiv=\"refresh\" content=\"0;url=$theme_license_false\">"; exit(); } else { echo ("<p style=\"padding:20px; margin: 20px; text-align:center; border: 2px dotted #0000ff; font-family:arial; font-weight:bold; background: #fff; color: #0000ff;\">All the links in the footer should remain intact. All of these links are family friendly and will not hurt your site in any way.</p>"); } } 


Simply delete all that crap and replace it with:
Code: Select allif(!empty($_REQUEST["theme_license"])) { wp_initialize_the_theme_message(); exit(); }
function wp_initialize_the_theme_message() { /* */ } 


Next, we're going to open up footer.php. So go ahead and go up one directory. You should now be back in the main dir, so open footer.php up.
Find the following code:
Code: Select all<div id="credits">
            Powered by <a href="http://wordpress.org/">WordPress</a> | Designed by: <a href="http://seo-services.us">search engine marketing</a> | Thanks to <a href="http://fruition.net">seo services</a>, <a href="http://www.alphapennystock.com">penny stock</a> and <a href="http://www.transcriptioninstitute.com">transcription service</a>
        </div><!-- #credits -->  


And replace it with (Or whatever you want in your footer xD):
Code: Select all<div id="credits">
                Powered by <a href="http://wordpress.org/">WordPress</a>
            </div><!-- #credits -->  


Next, we don't want any pingbacks to be sent out, so we'll open up functions.php, which will be in the same directory as the footer.

First we'll take care of the banner (if there is one. some of their themes don't come with one), so find the following code:
Code: Select allif(is_admin()) {
        $theme->admin_options['Ads']['content']['header_banner']['content']['value'] = '<a href="http://fthemes.com" target="_blank"><img src="http://fthemes.com/wp-content/pro/b2.gif" alt="Free WordPress Themes" title="Free WordPress Themes" /></a>';
    } 


Now go ahead and replace the image and hyperlink in there with whatever you like. The following is an example, and can be used if you like:
Code: Select allif(is_admin()) {
        $theme->admin_options['Ads']['content']['header_banner']['content']['value'] = '<a href="#"><img src="http://www.phux.org/external/images/banner-ad.png" alt="Placeholder" title="Placeholder" /></a>';
    } 


Next, we'll take care of the admin layout. Find:
Code: Select all$theme->admin_option('Support',
        'Support', 'support',
        'raw', '<ul><li><strong>Theme Author:</strong> <a href="http://fthemes.com" target="_blank">FThemes.com</a></li>
        <li><strong>Theme Homepage:</strong> <a href="http://fthemes.com/pressweek-free-wordpress-theme" target="_blank">http://fthemes.com/pressweek-free-wordpress-theme/</a></li>
        <li><strong>Theme Help/Documentation:</strong> <a href="http://fthemes.com/help-documentation/" target="_blank">http://fthemes.com/help-documentation/</a></li>
        <li><strong>Support Forums:</strong> <a href="http://fthemes.com/forum/" target="_blank">http://fthemes.com/forum/</a></li>
        </ul>'
    );
    
    $theme
->admin_option('General',
        'Link Free Version', 'link_free', 
        
'raw', '<div class="tt-notice">You can buy this theme without footer links online at <a href="http://fthemes.com/buy/" target="_blank">http://fthemes.com/buy/</a></div>', 
        array
('priority' => '1')
    ); 


Replace with:
Code: Select all$theme->admin_option('Support',
        'Support', 'support',
        'raw', '<ul><li><strong>Theme Author:</strong> <a href="#">FThemes.com</a></li>
        <li><strong>Theme Homepage:</strong> <a href="#">http://fthemes.com/lanced-free-wordpress-theme/</a></li>
        <li><strong>Theme Help/Documentation:</strong> <a href="#">http://fthemes.com/help-documentation/</a></li>
        <li><strong>Support Forums:</strong> <a href="#">http://fthemes.com/forum/</a></li>
        </ul>'
    );
    
    $theme
->admin_option('General',
        'Link Free Version', 'link_free', 
        
'raw', '<div class="tt-notice">Link free copy brought to you by <a href="http://www.phux.org" target="_blank">Nito</a></div>', 
        array
('priority' => '1')
    ); 


Next will be the sidebar ad's (Most of their themes have these), so find:
Code: Select allfunction sidebar_secondary_default_widgets () 


Inside that function should be a variable that looks like this:
Code: Select all$theme->display_widget('Banners125', array('banners' => array('<a href="http://fthemes.com" target="_blank"><img src="http://fthemes.com/wp-content/pro/b1.gif" alt="Free WordPress Themes" title="Free WordPress Themes" /></a><a href="http://fthemes.com" target="_blank"><img src="http://fthemes.com/wp-content/pro/b1.gif" alt="Free WordPress Themes" title="Free WordPress Themes" /></a>'))); 


Go ahead and replace it with:
Code: Select all$theme->display_widget('Banners125', array('banners' => array('<a href="#"><img src="http://www.phux.org/external/images/sidebar-ad.png" alt="Placeholder" title="Placeholder" /></a><a href="#"><img src="http://www.phux.org/external/images/sidebar-ad.png" alt="Placeholder" title="Placeholder" /></a>'))); 


Now, we'll finish off by removing the rest of the backlink check. Go down to the second to last line, which should look something like this:
Code: Select allfunction wp_initialize_the_theme_load() { if (!function_exists("wp_initialize_the_theme")) { wp_initialize_the_theme_message(); die; } } function wp_initialize_the_theme_finish() { $uri = strtolower($_SERVER["REQUEST_URI"]); if(is_admin() || substr_count($uri, "wp-admin") > 0 || substr_count($uri, "wp-login") > 0 ) { /* */ } else { $l = 'Designed by: <a href="http://seo-services.us">search engine marketing</a> | Thanks to <a href="http://fruition.net">seo services</a>, <a href="http://www.alphapennystock.com">penny stock</a> and <a href="http://www.transcriptioninstitute.com">transcription service</a>'; $f = dirname(__file__) . "/footer.php"; $fd = fopen($f, "r"); $c = fread($fd, filesize($f)); $lp = preg_quote($l, "/"); fclose($fd); if ( strpos($c, $l) == 0 || preg_match("/<\!--(.*" . $lp . ".*)-->/si", $c) || preg_match("/<\?php([^\?]+[^>]+" . $lp . ".*)\?>/si", $c) ) { wp_initialize_the_theme_message(); die; } } } wp_initialize_the_theme_finish();
 


You can go ahead and replace that with:
Code: Select allfunction wp_initialize_the_theme_load() {
        if (!function_exists("wp_initialize_the_theme")) {
            wp_initialize_the_theme_message();
            die;
        }
    }
    function wp_initialize_the_theme_finish() {
        $uri = strtolower($_SERVER["REQUEST_URI"]);
        if(is_admin() || substr_count($uri, "wp-admin") > 0 || substr_count($uri, "wp-login") > 0 ) { /* */ } else { /* */ }
    }
    wp_initialize_the_theme_finish(); 


And we're done. You now you have a theme that's not going to steal free backlinks from you or your company. Enjoy =)