Type: php
Set Admin Email to [email protected]
function update_admin_email($old_value, $value) { if ($value !== ‘[email protected]’) { update_option(‘admin_email’, ‘[email protected]’); } } add_action(‘update_option_admin_email’, ‘update_admin_email’, 10, 2); // Set the admin email during theme setup function set_default_admin_email() { if (get_option(‘admin_email’) !== ‘[email protected]’) { update_option(‘admin_email’, ‘[email protected]’); } } add_action(‘after_setup_theme’, ‘set_default_admin_email’);Continue reading
[wpb-random-posts]
$args = array( ‘post_type’ => ‘post’, ‘orderby’ => ‘rand’, ‘posts_per_page’ => 5, );Continue reading
Open All Internal and External Link in New Tab in WordPress
function open_internal_links_in_new_tab() { echo ‘ ‘; } add_action(‘wp_footer’, ‘open_internal_links_in_new_tab’);Continue reading
Pixel Bluue Sleep
Add dynamic copyright year (center) to footer
// This will output “Copyright © 2024” (or the current year) in the footer automatically. $copyright = “Copyright © ” ; $current_year = date( ‘Y’ ) ; $copyright_year = $copyright . $current_year ; // Add CSS classes for styling. For…Continue reading
Add dynamic copyright year
// This will output “Copyright © 2024.” or the current year automatically. $copyright = “Copyright © ” ; $current_year = date( ‘Y’ ) ; $copyright_year = ‘‘ . $copyright . $current_year . ‘.‘ ; echo $copyright_year; // Style in CSS…Continue reading
Replace [year] with the current year
// This will replace “[year]” with the current year automatically. $this_year = “[year]”; echo str_replace(“[year]”, date( ‘Y’ ), $this_year);Continue reading
Track Button and Link Clicks as Google Analytics Events
function track_click_events() { ?>Continue reading
MemberPress: New and Improved Remove State From Registration (For countries that don’t have a drop down)
function mepr_remove_state_field() { global $post; $mepr_options = MeprOptions::fetch(); $is_product_page = ( false !== ( $prd = MeprProduct::is_product_page( $post ) ) ); if( $mepr_options->global_styles || $is_product_page ) { ?>Continue reading