Created
July 27, 2020 18:48
-
-
Save seojacky/0686095ee9c2655c6b6c5dd5eef36537 to your computer and use it in GitHub Desktop.
Пример кода
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'the_title', 'add_version_to_title', 10); | |
function add_version_to_title( $title ){ | |
$post = get_post(); | |
$title .= " моё какое-то слово" ; | |
return $title; | |
} | |
//И тут внезапно следующая функция дописывает в альт title вложенного изображения + то самое " моё какое-то слово" | |
add_filter( 'wp_get_attachment_image_attributes', 'add_best_alt_attachment_image', 90, 2 ); | |
function add_best_alt_attachment_image( $attr, $attachment ) { | |
$attr['alt'] = get_the_title($attachment->ID); | |
return $attr; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment