Skip to content

Latest commit

 

History

History
41 lines (30 loc) · 2.33 KB

wp-filters.md

File metadata and controls

41 lines (30 loc) · 2.33 KB

WP filters

Both ThemeImage and UploadImage objects allows you to change some of their outputs using WP filter mechanism.

ThemeImage filters

  • fri_theme_img_url Change theme file URL. Arguments:

  • fri_theme_img_path Change theme file path. Arguments:

    • string $path Default image path in theme root, eg. '/Users/fronty/www/domain.com/themes/your-theme/image.jpg'
    • string $file File name with extension, eg. 'image.jpg'
  • fri_theme_img_tag Change HTML output of <img> tag. Used in getImgTag() and imgTag(). Arguments:

    • Html $img Html image object
    • ImageSize $size ImageSize given as method's input
  • fri_theme_aspect_img_tag Change HTML output of <figure class="ratio">. Used in getAspectImgTag() and aspectImgTag() methods. Arguments:

    • Html $figure Html figure object including image as it's child
    • int $width Width for ratio calculation.
    • int $height Height for ratio calculation.
    • float $ratio Calculated ratio in percents.

UploadImage filters

  • fri_upload_img_tag Change HTML output of non-responsive <img> tag. Used in getImgTag(), imgTag(). Arguments:

    • Html $img Html image object
    • ImageSize $size ImageSize given as method's input
  • fri_upload_responsive_img_tag Change output of responsive <img> tag. Used in getResponsiveImgTag() and responsiveImgTag() methods. Arguments:

    • Html $img Html image object
    • ImageSizeList $sizes ImageSizeList given as method's input
  • fri_upload_aspect_img_tag Change HTML output of <figure class="ratio">. Used in getAspectImgTag() and aspectImgTag() methods. Arguments:

    • Html $figure Html figure object including image as it's child
    • int $width Width for ratio calculation.
    • int $height Height for ratio calculation.
    • float $ratio Calculated ratio in percents.
    • ImageSizeList|null $sizes ImageSizeList for child responsive image.