Noindex & Nofollow Posts

add_filter( ‘aioseo_robots_meta’, ‘aioseo_filter_robots_meta’ ); function aioseo_filter_robots_meta( $attributes ) { if ( is_singular() ) { $attributes[‘noindex’] = ‘index’; $attributes[‘nofollow’] = ‘nofollow’; } return $attributes; }Continue reading

Display the Last Updated Date (copy)

$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

Livrare 20kg plus

add_action( ‘woocommerce_after_shipping_rate’, ‘action_after_shipping_rate’, 20, 2 ); function action_after_shipping_rate ( $method, $index ) { // Targeting checkout page only: if( is_cart() ) return; // Exit on cart page if( ‘flat_rate:1’ === $method->id ) { echo __(“ Cheltuielile de livare nu sunt…Continue reading

Add Image Alt Text automatic

function add_alt_text_to_images( $html ) { // Check if the image has a title attribute if ( preg_match( ‘/(title=[“\’].*?[“\’])/’, $html, $matches ) ) { // Get the title $title = substr( $matches[0], 7, -1 ); // Check if the image has…Continue reading

Disable Emojis

/** * Disable the emojis in WordPress. */ add_action( ‘init’, function () { remove_action( ‘wp_head’, ‘print_emoji_detection_script’, 7 ); remove_action( ‘admin_print_scripts’, ‘print_emoji_detection_script’ ); remove_action( ‘wp_print_styles’, ‘print_emoji_styles’ ); remove_action( ‘admin_print_styles’, ‘print_emoji_styles’ ); remove_filter( ‘the_content_feed’, ‘wp_staticize_emoji’ ); remove_filter( ‘comment_text_rss’, ‘wp_staticize_emoji’ ); remove_filter( ‘wp_mail’,…Continue reading

Allow SVG Files Upload

/** * Allow SVG uploads for administrator users. * * @param array $upload_mimes Allowed mime types. * * @return mixed */ add_filter( ‘upload_mimes’, function ( $upload_mimes ) { // By default, only administrator users are allowed to add SVGs. //…Continue reading

Add default ALT to avatar/Gravatar Images

add_filter( ‘pre_get_avatar_data’, function ( $atts ) { if ( empty( $atts[‘alt’] ) ) { if ( have_comments() ) { $author = get_comment_author(); } else { $author = get_the_author_meta( ‘display_name’ ); } $alt = sprintf( ‘Avatar for %s’, $author ); $atts[‘alt’]…Continue reading