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
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
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
// Function to return the current year function shortcode_year() { return date(‘Y’); } // Register the shortcode [year] to use in posts, pages, and widgets add_shortcode(‘year’, ‘shortcode_year’);Continue reading
$u_time = get_the_time( ‘U’ ); $u_modified_time = get_the_modified_time( ‘U’ ); // Only display modified date if 24hrs have passed since the post was published. if ( $u_modified_time >= $u_time + 86400 ) { $updated_date = get_the_modified_time( ‘F jS, Y’ );…Continue reading
function enqueue_custom_styles_scripts() { wp_enqueue_style(‘progress-bar-style’, get_template_directory_uri() . ‘/progress-bar-style.css’); wp_enqueue_script(‘progress-bar-script’, get_template_directory_uri() . ‘/progress-bar.js’, array(‘jquery’), null, true); } add_action(‘wp_enqueue_scripts’, ‘enqueue_custom_styles_scripts’); function custom_progress_bar_shortcode($atts) { $atts = shortcode_atts([ ‘range_major’ => ‘100’, ‘current_major’ => ’50’, ‘label_major’ => ‘Major Progress’, ‘range_minor’ => ‘100’, ‘current_minor’ => ’25’ ],…Continue reading