Last active
August 29, 2015 14:17
-
-
Save vajrasar/7ab682dd88420fbe2b28 to your computer and use it in GitHub Desktop.
[Envira Gallery] Title with Link to Image (LightBox) - Problem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| This was working fine, I was able to show Title of image with a hyperlink to image lightbox. | |
| But suddenly from past a week site was down, when I checked error logs it stated | |
| that the code (which was in my functions.php) is throwing error - PHP Parse error: syntax error, unexpected '[' | |
| That error was in Line 24 of this code. | |
| */ | |
| function envira_gallery_image_titles( $output, $id, $item, $data, $i ) { | |
| // IDs of galleries to display titles on | |
| $galleriesToShowTitles = array( | |
| 245 | |
| ); | |
| // Check if we need to display titles on this gallery | |
| if ( !in_array( $data['id'], $galleriesToShowTitles ) ) { | |
| return $output; | |
| } | |
| if ( isset( $item['title'] )) { | |
| $output .= '<div class="title"><a href="' . $data['gallery'][$id]['link'] . '" class= "envira-gallery-245 envira-gallery-link" title="' . $item['title'] . '" rel="' . ['gallery'] . '" data-thumbnail>' . $item['title'] . '</a></div>'; | |
| } | |
| return $output; | |
| } | |
| add_action( 'envira_gallery_output_after_link', 'envira_gallery_image_titles', 10, 5 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment