Merhaba arkadaşlar. PHP bilmediğimden şu sorunu halledemedim. Sizlerden yardım bekliyorum. wp-includes/media.php dosyasında 2 tane fonksiyondan birinde işe yarayan bir değişken diğerinde işe yaramıyor. Değişken şu: esc_attr($alt)
Fonksiyonlar ise şunlar;
1. Fonksiyon
function get_image_tag($id, $alt, $title, $align, $size='medium') {
/** * Filter the value of the attachment's image tag class attribute. * * @since 2.6.0 * * @param string $class CSS class name or space-separated list of classes. * @param int $id Attachment ID. * @param string $align Part of the class name for aligning the image. * @param string $size Optional. Default is 'medium'. */ $class = apply_filters( 'get_image_tag_class', $class, $id, $align, $size );
$html = '';
/** * Filter the HTML content for the image tag. * * @since 2.6.0 * * @param string $html HTML content for the image. * @param int $id Attachment ID. * @param string $alt Alternate text. * @param string $title Attachment title. * @param string $align Part of the class name for aligning the image. * @param string $size Optional. Default is 'medium'. */ $html = apply_filters( 'get_image_tag', $html, $id, $alt, $title, $align, $size );
return $html; }
2. Fonksiyon:
function img_caption_shortcode( $attr, $content = null ) { // New-style shortcode with the caption inside the shortcode with the link and image tags. if ( ! isset( $attr['caption'] ) ) { if ( preg_match( '#((?:]+>\s*)?]+>(?:\s*)?)(.*)#is', $content, $matches ) ) { $content = $matches[1]; $attr['caption'] = trim( $matches[2] ); } }
/** * Filter the default caption shortcode output. * * If the filtered output isn't empty, it will be used instead of generating * the default caption template. * * @since 2.6.0 * * @see img_caption_shortcode() * * @param string $output The caption output. Default empty. * @param array $attr Attributes of the caption shortcode. * @param string $content The image element, possibly wrapped in a hyperlink. */ $output = apply_filters( 'img_caption_shortcode', '', $attr, $content ); if ( $output != '' ) return $output;
/** * Filter the width of an image's caption. * * By default, the caption is 10 pixels greater than the width of the image, * to prevent post content from running up against a floated image. * * @since 3.7.0 * * @see img_caption_shortcode() * * @param int $caption_width Width of the caption in pixels. To remove this inline style, * return zero. * @param array $atts Attributes of the caption shortcode. * @param string $content The image element, possibly wrapped in a hyperlink. */
Benim sorum şu: 1. Fonksiyondaki esc_attr($alt) değişkeni resimlerin alternatif yazılarını çekebiliyorken 2. Fonksiyondaki esc_attr($alt) değişkeni bunu yapamıyor. esc_attr($alt) değişkenini 2. Fonksiyonda da etkin hale nasıl getirebilirim?
Tamamen sallayarak (:D);
esc_attr($alt) yerine
esc_attr( get_the_ID() ) belki olabilir.
Maalesef hocam. 5809 diye bir sayıyı bastı. Bana ise resme girilen alternatif yazıyı çekecek bir değişken lazım. Yazılara eklenen resimlerin id'sini nasıl alabilirim, bu konu hakkında bilginiz var mı peki?
Maalesef hocam. 5809 diye bir sayıyı bastı. Bana ise resme girilen alternatif yazıyı çekecek bir değişken lazım. Yazılara eklenen resimlerin id'sini nasıl alabilirim, bu konu hakkında bilginiz var mı peki?
Hocam bu farklı. Bu, öne çıkarılan resmin alternatif yazısını çekiyor.
Mesela aşağıdaki kodları eklediğimde öne çıkarılan resmin alternatif yazısını çekebiliyorum ama benim istediğim şey, her upload edilmiş ve yazıya eklenmiş resmin alternatif yazısını çekebilecek bir kod..