• expat

    (@expat)


    How to format the image output?

    does anyone know where i can format the html output of the image? In which file thanks

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author David Aguilera

    (@davilera)

    Hi!

    We use the following filter: post_thumbnail_html. Not all themes “support” it (it actually depends on the functions they use to print the featured image), but if they do, our plugin can change the featured image.

    Hooking into this filter after we do (using a priority >10) will do the trick!

    Regards,
    David

    Thread Starter expat

    (@expat)

    hi, thanks for reply,

    which file did you call that function from, thanks? what if i need to add a class to that image or a parent div element, thanks

    Plugin Author David Aguilera

    (@davilera)

    The file is wp-content/plugins/external-featured-image/includes/nelio-efi-main.php, line 162 or so. But that doesn’t really matter; you simply need to hook into the filter I mentioned before – it takes one argument (the HTML that corresponds to the featured image) and returns one string (the original argument with any changes you might have applied, or a completely new tag).

    Thread Starter expat

    (@expat)

    I am sorry I am a noob ?? can you explain that further….When first WP scans a post for caching, how do i hook into the filter? Can you give example please?

    i assume that i would need to hack into this plugin’s php file to do so
    Unless i do it from the theme’s function file?

    kikozw

    (@kikozw)

    I love how in two weeks the plugin author didnt help or reply to anyone…

    • This reply was modified 8 years ago by kikozw.
    Thread Starter expat

    (@expat)

    not sure why you hijacked my thread though because he is replying ??

    Perhaps you need to word your query a little differently in order to engage him ??

    kikozw

    (@kikozw)

    Im not hyjacking your thread in any way, and that isnt my intetion at all. I just think the plugin author should help or at least reply to the other 5 people that are waiting for his help.<
    And since this is the latest thread that he replied, i kinda felt obligated to say that.

    Plugin Author David Aguilera

    (@davilera)

    Hi guys!

    @kikozw, I’m sorry I didn’t reply to you sooner. I just saw this topic in my inbox, had some time to reply it, click on the link and came directly to this page – I didn’t even think about looking at “old” topics… my bad! Anyway, I already replied to your question (as you’ll see, though, I couldn’t help you – yet).

    @expat, what are you trying to do exactly? You can use CSS rules to “style” the final featured image, or you can use WordPress hooks to modify the HTML structure. If you want to tweak the HTML, add the following snippet in your theme’s functions.php file:

    
    function expat_tweak_image( $html ) {
      $html = '<img src="..." />'; // <-- tweak this as you please
      return $html;
    }
    add_filter( 'post_thumbnail_html', 'expat_tweak_image', 10 );
    
    Plugin Author David Aguilera

    (@davilera)

    Any news, guys? Were you able to fix the issue? Did you try Nelio Content?

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘How to format the image output?’ is closed to new replies.