Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image caption on images in list #45

Closed
ErikXXon opened this issue Jul 10, 2014 · 1 comment
Closed

Image caption on images in list #45

ErikXXon opened this issue Jul 10, 2014 · 1 comment

Comments

@ErikXXon
Copy link

Have try to get the wordpress image caption to work with Arlima listed images. Have looked into filters and so on,.. is that hard to get?

I would have it to write some info like: Photo by: ....

Maby this code:
// Caption (explicitly)
echo $post->post_excerpt; // Raw
if ( has_excerpt() ) {
the_excerpt();
}

@victorjonsson
Copy link
Owner

I was surprised that the filter needed in this case didn't already exist... It's implemented now however. I've added the following to the documentation.


You can use filter arlima_article_image_tag if you only want to decorate the HTML of the generated image.

// Add caption to arlima images displayed in full
function my_arlima_image_captions($html, $img_size, $article) {
  if( $img_size == 'full' ) {
    $attach = get_post($article['image']['attachment']);
    $img_template = '<div class="img-wrapper">%s<div class="caption">%s</div></div>';
    $html = sprintf($img_template, $html, $attach->post_excerpt);
  }
  return $html; 
}
add_filter('arlima_article_image_tag', 'my_arlima_image_captions', 10, 3);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants