Unicalization images in the page with number
-
Can you implement unicalization for images with same post name in alt text? For example by adding image number to text end: if page content 3 images and post name is “My post name”, alt text for first image will be My post name – 1, for second My post name – 2, for third My post name – 3… I implement it in DomHelper trait setEmpty()/setNotEmpty() static function as third variable with default null value, but after updating it will be lost.
// DomHelper public function setEmpty($option, $node, $img_url, $num = null) { if ( Option::check($option) ) { $numText = $num ? ' - ' . $num : ''; switch ( Option::get($option) ) { case Option::get($option) == 'alt_empty_fkw': $node->setAttribute("alt", $this->focus_keyword() . $this->site_title() . $numText); break; ...
// DomController $imagesNodes = $html->query( "https://img" ); for ($i = 0; $i < count($imagesNodes); $i++ ) { $node = $imagesNodes[$i]; // Return image URL $img_url = $node->getAttribute( "src" ); // Set alt for Post & Pages if ( is_singular( array( 'post', 'page' ) ) ) { $index = $i + 1; ....
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Unicalization images in the page with number’ is closed to new replies.