Skip to content

Instantly share code, notes, and snippets.

@mikeemoo
Created May 22, 2012 16:19
Show Gist options
  • Save mikeemoo/2770055 to your computer and use it in GitHub Desktop.
Save mikeemoo/2770055 to your computer and use it in GitHub Desktop.
redeclare wordpress methods
<?php
/*
Plugin Name: Symfony2 Bridge
Plugin URI: http://www.lowpress.com
Description: Integrate Symfony2 and Wordpress
Author: Mikee Franklin
Version: 1.0
Author URI: http://www.lowpress.com
*/
function rename_template_functions()
{
$theme_file = ABSPATH . WPINC.'/theme.php';
$contents = file_get_contents($theme_file);
$contents = preg_replace("/function\s+(locate|load)_template(\s*)/", "function \\1_template_old\\2", $contents);
file_put_contents($theme_file, $contents);
}
if (function_exists('locate_template') || function_exists('load_template'))
{
rename_template_functions();
}
else
{
if (!function_exists('locate_template'))
{
function locate_template($template_names, $load = false, $require_once = true )
{
}
}
if (!function_exists('load_template'))
{
function load_template( $_template_file, $require_once = true )
{
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment