“New” Badge for Recent Posts

add_filter( ‘the_title’, function ( $title, $id ) { if ( ! is_admin() && is_single( $id ) ) { $number_of_days = 7; $post_date = get_the_date( ‘U’, $id ); $current_date = current_time( ‘timestamp’ ); $date_diff = $current_date – $post_date; if ( $date_diff…Continue reading

Limiting Options for the Date / Time Field

/** Don’t allow date to be selected after maxDate Original doc link: https://wpforms.com/developers/customize-the-date-time-field-date-options/ For support, please visit: https://www.facebook.com/groups/wpformsvip */ function wpf_dev_limit_date_picker() { ?>Continue reading

WPForms Login Page Redirect

/* Modify the login URL to redirect to a custom login page. Original doc link: https://wpforms.com/how-to-create-a-custom-login-form-for-improved-site-branding/ For support, please visit: https://www.facebook.com/groups/wpformsvip */ function sulliesflowers_custom_login_url( $login_url, $redirect, $force_reauth ) { // Change here your login page url $login_url = ‘https://sulliesflowers.com/login/’; if…Continue reading

404 to home

function redirect_404_to_home() { if (is_404()) { wp_redirect(home_url()); exit(); } } add_action(‘template_redirect’, ‘redirect_404_to_home’);Continue reading

add_language_to_external_link

function append_language_to_external_links($content) { // Get the current language of your blog $current_language = apply_filters( ‘wpml_current_language’, NULL ); if ($current_language == “en”){ $current_language = “”; } // Create a DOMDocument instance to parse the content $dom = new DOMDocument(); libxml_use_internal_errors(true); //…Continue reading

“Generar y Publicar Posts Automáticamente con ChatGPT”

function generate_and_publish_post() { $api_key = ‘skprojXVTIVxQQ5Ehpxp775DRhT3BlbkFJcdNbKiiJVJUGkqJGmBYu’; $unsplash_api_key = ‘6Nw90BNuEg5uEnRmMqpw05JLdTQ8onddGfA5e_XYlmQ’; $youtube_api_key = ‘AIzaSyC1tv1pocoHLfHtPAMsOykbLjmgdNwxaf0’; $wp_token = ‘eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3RlY2hub3ZlZGFkZXMuY29tIiwiaWF0IjoxNzE2MDY0Mjg5LCJuYmYiOjE3MTYwNjQyODksImV4cCI6MTcxNjY2OTA4OSwiZGF0YSI6eyJ1c2VyIjp7ImlkIjoiMSJ9fX0.SwHK1aGMTveqMnTZN04UKiFtHMZuN1312PHWYzWklv0’; $wp_username = ‘charlyl’; $wp_password = ‘L1910901$’; $topics = array( ‘tecnologia’, ‘salud y bienestar’, ‘desarrollo personal’, ‘finanzas personales’, ‘viajes y turismo’ ); $tema = $topics[array_rand($topics)]; //…Continue reading

Woocommerce Checkout fields

function custom_override_checkout_fields( $fields ) { // Unset billing fields // unset($fields[‘billing’][‘billing_first_name’]); // unset($fields[‘billing’][‘billing_last_name’]); unset($fields[‘billing’][‘billing_company’]); unset($fields[‘billing’][‘billing_address_1’]); unset($fields[‘billing’][‘billing_address_2’]); unset($fields[‘billing’][‘billing_city’]); unset($fields[‘billing’][‘billing_postcode’]); unset($fields[‘billing’][‘billing_country’]); unset($fields[‘billing’][‘billing_state’]); unset($fields[‘billing’][‘billing_phone’]); // Unset shipping fields if not needed unset($fields[‘shipping’][‘shipping_first_name’]); unset($fields[‘shipping’][‘shipping_last_name’]); unset($fields[‘shipping’][‘shipping_company’]); unset($fields[‘shipping’][‘shipping_address_1’]); unset($fields[‘shipping’][‘shipping_address_2’]); unset($fields[‘shipping’][‘shipping_city’]); unset($fields[‘shipping’][‘shipping_postcode’]); unset($fields[‘shipping’][‘shipping_country’]); unset($fields[‘shipping’][‘shipping_state’]); // Return the…Continue reading

Completely Disable Comments

add_action(‘admin_init’, function () { // Redirect any user trying to access comments page global $pagenow; if ($pagenow === ‘edit-comments.php’) { wp_safe_redirect(admin_url()); exit; } // Remove comments metabox from dashboard remove_meta_box(‘dashboard_recent_comments’, ‘dashboard’, ‘normal’); // Disable support for comments and trackbacks in…Continue reading