give_linked_images_class

The Evolved give linked images class function.

Description

give_linked_images_class( $html, $id, $caption, $title, $align, $url, $size, (string) $alt = '' ); 

Parameters (8)

0. $html
The html.
1. $id
The id.
2. $caption
The caption.
3. $title
The title.
4. $align
The align.
5. $url
The url.
6. $size
The size.
7. $alt — Optional. (string) => ''
The alt.

Usage

  1. if ( !function_exists( 'give_linked_images_class' ) ) { 
  2. require_once '/functions.php'; 
  3.  
  4. // The html. 
  5. $html = null; 
  6.  
  7. // The id. 
  8. $id = null; 
  9.  
  10. // The caption. 
  11. $caption = null; 
  12.  
  13. // The title. 
  14. $title = null; 
  15.  
  16. // The align. 
  17. $align = null; 
  18.  
  19. // The url. 
  20. $url = null; 
  21.  
  22. // The size. 
  23. $size = null; 
  24.  
  25. // The alt. 
  26. $alt = ''; 
  27.  
  28. // NOTICE! Understand what this does before running. 
  29. $result = give_linked_images_class($html, $id, $caption, $title, $align, $url, $size, $alt); 
  30.  

Defined (1)

The function is defined in the following location(s).

/functions.php  
  1. function give_linked_images_class($html, $id, $caption, $title, $align, $url, $size, $alt = '' ) {  
  2. $classes = 'img img-bevel'; 
  3.  
  4. // check if there are already classes assigned to the anchor  
  5. if ( preg_match('/<a.*? class=".*?">/', $html) ) {  
  6. $html = preg_replace('/(<a.*? class=".*?)(".*?>)/', '$1 ' . $classes . '$2', $html);  
  7. } else {  
  8. $html = preg_replace('/(<a.*?)>/', '$1 class="' . $classes . '" >', $html);  
  9. }  
  10. return $html;  
  11. }