Theme Functions

Replace Any Text
 Just replace FUNCTION_NAME with unique function name and place in functions.php file.     add_filter( 'gettext', 'replace_FUNCTION_NAM...
Thu, 6 Aug, 2015 at 7:21 PM
If Function Exists Condition
if ( function_exists('FUNCTION_NAME') ){ FUNCTION HERE } Sample: if ( function_exists('vt_resize') ){ $image = vt_resize( $thumb, &...
Mon, 5 Nov, 2018 at 3:32 PM
Add Custom Sidebar
 In theme functions.php:   add_action( 'widgets_init', 'my_register_sidebars' ); function my_register_sidebars() { register_sideb...
Thu, 10 Dec, 2015 at 8:17 AM
Turn Off Plugin Errors
Put in theme functions.php to turn off admin plugin error notice.   function fix_errors($errno, $errstr, $errfile, $errline, $errcontext) { if (defin...
Mon, 5 Nov, 2018 at 3:33 PM
Get Last Posts with Thumbnail Shortcode
  It can be edited a little bit, to have the option to get the featured image and if empty, then to get the thumbnail.  You can pick what you like. f...
Mon, 5 Nov, 2018 at 3:34 PM
Change Any Text
Add this to your active theme's functions.php file and adjust text need locations in code snippet below. /* Change Text Site Wide */ function wpfi...
Mon, 5 Nov, 2018 at 3:35 PM
Correct Mediaelementplayer Is Not a Function
Uncaught TypeError: b(...).not(...).filter(...).mediaelementplayer is not a function add_action('wp_enqueue_scripts', 'my_register_javasc...
Mon, 5 Nov, 2018 at 3:36 PM
Removing enable jquery migrate notice
ADD TO FUNCTIONS.PHP:  add_action('admin_head', 'my_custom_admin_css'); function my_custom_admin_css() {   echo '<style>...
Thu, 14 Jan, 2021 at 10:24 AM
Header Redirect
SET REDIRECT IN HEADER.PHP FILE: <?php if (!is_user_logged_in()) { wp_redirect( 'URL_GOES_HERE'); exit; } ?>
Fri, 7 May, 2021 at 1:14 PM
Create new user automatically via functions.php
add_action('init', 'add_my_user'); function add_my_user() { $username = 'wpfixit'; $email = 'support@wpfixit.com...
Tue, 14 Jun, 2022 at 7:00 AM