• Resolved alex.fedoseev

    (@alexfedoseev)


    Hi.

    I’m using gallery plugin and I’d like to put the title in every _a_ tag of image thumbs.
    Here is the plugin: https://www.ads-software.com/extend/plugins/gallery-plugin/

    Here is the code:

    <a rel="<?php echo $post->ID; ?>" href="<?php echo $image_attributes_large[0]; ?>" title="<?php echo get_post_meta( $attachment->ID, $key, true ); ?>">
    <img alt="" title="<?php echo get_post_meta( $attachment->ID, $key, true ); ?>" src="<?php echo $image_attributes[0]; ?>" rel="<?php echo $image_attributes_full[0]; ?>" />
    											</a>

    title=”<?php echo get_post_meta( $attachment->ID, $key, true ); ?>” returns nothing.
    How can I get the title of the image?

    Thanks in advance!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter alex.fedoseev

    (@alexfedoseev)

    I just removed line
    title="<?php echo get_post_meta( $attachment->ID, $key, true ); ?>"
    from this code, but the empty title appears again in _a_ tag.

    Something is rewriting title in a tag, but I can’t get where is the code, that doing this.

    P.S. I know that this is right part of code, because rel=”<?php echo $post->ID; ?>” works fine.

    Thread Starter alex.fedoseev

    (@alexfedoseev)

    Replaced with this code and titles showed up:

    <a rel="<?php echo $post->ID; ?>" href="<?php echo $image_attributes_large[0]; ?>" title="<?php echo $attachment->post_title; ?>">
    <img alt="<?php echo $attachment->post_title; ?>" title="<?php echo $attachment->post_title; ?>" src="<?php echo $image_attributes[0]; ?>" rel="<?php echo $image_attributes_full[0]; ?>" />
    </a>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to get image title in gallery plugin?’ is closed to new replies.