Theme Functions

Replace Any Text
 Just replace FUNCTION_NAME with unique function name and place in functions.php file.     add_filter( 'gettext', 'replace_FUNCTION_NAME_t...
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_sidebar( ...
Thu, 10 Dec, 2015 at 8:17 AM
Turn Off Plugin Errors
Put in wpconfig.php ini_set('display_errors','Off'); ini_set('error_reporting', E_ALL ); define('WP_DEBUG', false); def...
Mon, 25 Sep, 2023 at 4:16 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_javascrip...
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> .n...
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 = 'username_here'; $email = 'email_here'; ...
Wed, 6 Mar, 2024 at 4:03 AM