Auto Filling Alt Tag for Images
A WordPress plugin that automatically adds `alt` attributes to images that are missing one or have an empty `alt` attribute. The plugin scans the content and assigns the closest heading (`h1`, `h2`, etc.) above the image as the `alt` text.
by Hassan Ali Askari · github.com/hassan7303/auto-filling-alt-tag-for-images · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/hassan7303/auto-filling-alt-tag-for-images/archive/refs/heads/master.zipDeclares an update source (https://github.com/hassan7303/Auto-filling-alt-tag-for-images), so updates arrive through the plugin's own updater.
Readme
Auto Filling Alt Tag for Images
Description
A WordPress plugin that automatically adds alt attributes to images that are missing one or have an empty alt attribute. The plugin scans the content and assigns the closest heading (h1, h2, etc.) above the image as the alt text.
Features
- Automatically assigns
altattributes to images without one. - Extracts text from the nearest heading (
h1toh6) above the image. - Provides a default
alttext if no heading is found.
Installation
- Download the plugin as a
.phpfile. - Upload the file to the
wp-content/pluginsdirectory of your WordPress site. - Log in to your WordPress dashboard and navigate to the Plugins section.
- Locate Auto Alt Tag for Images in the plugins list and click Activate.
How It Works
- The plugin hooks into the
the_contentfilter. - Scans the post content for
<img>tags. - If an
imgtag has noaltattribute or thealtis empty:- Searches for the nearest heading (
h1,h2, etc.) above the image in the HTML structure. - Assigns the text content of the heading as the
altattribute. - If no heading is found, assigns a default
alttext (default alt text).
- Searches for the nearest heading (
Automatic Updates
This plugin connects to the GitHub repository and automatically fetches updates when a new version is released.
Make sure that WordPress automatic updates for plugins are enabled.
Contribution
- Fork the repository on GitHub.
- Implement your changes.
- Create a Pull Request to submit your changes.
پر کردن خودکار برچسب Alt برای تصاویر
توضیحات
یک افزونه وردپرس که به طور خودکار ویژگیهای «alt» را به تصاویری که یکی ندارند یا دارای ویژگی «alt» خالی هستند اضافه میکند. این افزونه محتوا را اسکن می کند و نزدیکترین عنوان ('h1'، 'h2'، و غیره) را در بالای تصویر به عنوان متن 'alt' اختصاص می دهد.
امکانات
- به طور خودکار ویژگی های «alt» را به تصاویر بدون آن اختصاص می دهد.
- متن را از نزدیکترین عنوان ('h1' تا 'h6') بالای تصویر استخراج می کند.
- در صورت یافتن هیچ عنوان، یک متن جایگزین پیشفرض ارائه میکند.
نصب
۱. فایل ZIP افزونه را از گیتهاب دانلود کنید.
۲. وارد پیشخوان وردپرس شوید.
۳. به مسیر افزونهها → افزودن → بارگذاری افزونه بروید.
۴. فایل ZIP دانلود شده را آپلود کرده و افزونه را فعال کنید.
استفاده
- افزونه به فیلتر «the_content» متصل میشود.
- محتوای پست را برای برچسبهای «
» اسکن میکند.
- اگر یک تگ «img» فاقد ویژگی «alt» باشد یا «alt» خالی باشد:
- نزدیکترین عنوان ('h1'، 'h2'، و غیره) را در بالای تصویر در ساختار HTML جستجو می کند.
- محتوای متن عنوان را به عنوان ویژگی alt اختصاص می دهد.
- اگر عنوانی پیدا نشد، یک متن جایگزین پیشفرض (متن جایگزین پیشفرض) اختصاص میدهد.
بروزرسانی خودکار
این افزونه به مخزن گیتهاب متصل است و در صورت وجود نسخه جدید به صورت خودکار آن را دریافت میکند.
مطمئن شوید که آپدیتهای خودکار وردپرس برای افزونهها فعال باشد.
مشارکت
۱. این مخزن را در گیتهاب Fork کنید.
۲. تغییرات موردنظر خود را اعمال کنید.
۳. یک Pull Request برای ارسال تغییرات ایجاد کنید.
Read the full README on GitHub →
Releases
| Tag | Published |
|---|---|
| 1.0.0 | Dec 10, 2024 |
These releases are tags only. The author does not attach a packaged zip, so there are no download counts to report.