add_shortcode('img-info', 'func_img_info');
function func_img_info($atts) {
global $post, $wpdb;
$attachment_id = $wpdb->get_var($wpdb->prepare(
"SELECT ID FROM $wpdb->posts WHERE guid=%s",
$atts['url']
));
$caption = get_the_excerpt($attachment_id);
return $caption;
}
Minesh is on vacation, I will take care of this thread.
I cam log into your website, but it is not an administrator account.
Since it is a custom codes problem, please provide below details:
1) Valid administrator account + FTP access
2) Where and how can I see the problem? please point out the problem page URL and where I can edit your PHP codes,
I need to test it in a live website, thanks
Luo,
I tried to add php codes to functions.php and got an error on the first line of code. Can you please try for me? I'm trying on a different website.
The Website is hidden link
Password is tralex61####
This website has 2 galleries. one is Oceanwalk and the other is seaside. If you go to oceanwalk info in the menu and go a little bit down the page you will see where I have the gallery. It is called with the content template. The only difference in these galleries is that the field is photo. I'm using the Astra theme, so if you go to appearance and themes you will see theme editor where you can add code to functions.php. Thanks, Aaron
2) Edit the content template "Template for Photo Galleries", display the image file caption and title with above custom shortcode, line 7~8: hidden link
That is a custom CSS codes problem, I have done below modification in your website:
Edit the content template: hidden link
1) Modify the codes as below: