add_filter( 'post_thumbnail_html', 'filter_function_name_9525', 10, 5 );
function filter_function_name_9525( $html, $post_id, $post_thumbnail_id, $size, $attr ){
$append = ('my_alt' == $attr['alt'] ? 'Yes!' : 'sorry, but no.');
$append = '<p>' . $append . '</p>';
return $html . '<p>' . $append . '</p>';
}
function tesp_menu_page_cb(){
?><h1>Плагин для тестирования функций</h1><?php
$id = 13;
$size = 'thumbnail';
$attr = array('alt' => 'my_alt' );
$thumbnail = get_the_post_thumbnail( $id, $size, $attr );
echo $thumbnail;
$attr = array('alt' => 'nothing' );
$thumbnail = get_the_post_thumbnail( $id, $size, $attr );
echo $thumbnail;
}
то ничего не работает.
add_filter('post_thumbnail_html', 'multi_format_thumbnail', 10, 5);
/**
* Filters the post thumbnail HTML.
*
* @since 2.9.0
*
* @param string $html The post thumbnail HTML.
* @param int $post_id The post ID.
* @param string $post_thumbnail_id The post thumbnail ID.
* @param string|array $size The post thumbnail size. Image size or array of width and height
* values (in that order). Default 'post-thumbnail'.
* @param string $attr Query string of attributes.
*/
function multi_format_thumbnail( $html, $post_id, $post_thumbnail_id, $size, $attr ){
};
/************************************************************************/
/* меняем текст кнопки у товара*/
add_filter( 'woocommerce_product_add_to_cart_text', 'pytex_woocommerce_product_add_to_cart_text', 99, 2 );
function pytex_woocommerce_product_add_to_cart_text($text, $product){
$out = $text;
if ( 'Подробнее' == $text) {
$out = 'Под заказ';
}
return $out;
Там есть хуки before и after
Может автор левша