functions.php Archives - Justin Silver https://www.justinsilver.com/tag/functions-php/ Technology, Travel, and Pictures Tue, 19 Apr 2016 18:25:36 +0000 en-US hourly 1 https://wordpress.org/?v=6.0.1 https://www.justinsilver.com/wp-content/uploads/2013/06/cropped-apple-touch-icon-160x160.png functions.php Archives - Justin Silver https://www.justinsilver.com/tag/functions-php/ 32 32 WordPress Plugin: Custom Functions.php https://www.justinsilver.com/technology/wordpress/wordpress-plugins/wordpress-plugin-custom-functions-php/?utm_source=rss&utm_medium=rss&utm_campaign=wordpress-plugin-custom-functions-php https://www.justinsilver.com/technology/wordpress/wordpress-plugins/wordpress-plugin-custom-functions-php/#respond Wed, 07 Nov 2012 19:04:23 +0000 http://justin.ag/?p=2814 One of the limitations of adding code to your theme’s function.php file is that these modifications are lost if you change themes, and another is that it is executed after your plugin files are...

The post WordPress Plugin: Custom Functions.php appeared first on Justin Silver.

]]>
AmpedSense.OptimizeAdSpot('AP'); AmpedSense.OptimizeAdSpot('IL'); AmpedSense.OptimizeAdSpot('IR');

One of the limitations of adding code to your theme’s function.php file is that these modifications are lost if you change themes, and another is that it is executed after your plugin files are loaded. This means that if you want to modify any behavior in your other plugins that call filtered functions but aren’t hooked to WordPress Actions, you’re out of luck.

I have worked around this on all my sites by creating a custom plugin to handle all of my non-theme specific additions. The only thing this plugin does is ensure that it is loaded first when you activate it, and then pulls in the contents of a functions.php file in the parent plugins directory. The result is that you have custom code running before any of your other plugins. The functions.php file is specifically not included, but it would just but a standard PHP file like the one in your theme.

This file is always up to date based on the trunk of my SVN repository.

custom-functions.php

<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.23.1</center>
</body>
</html>

The post WordPress Plugin: Custom Functions.php appeared first on Justin Silver.

]]>
https://www.justinsilver.com/technology/wordpress/wordpress-plugins/wordpress-plugin-custom-functions-php/feed/ 0