-
-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Labels
Description
How would I construct the shortcode so it displays the photo credit table for all photos attached to the current post? currently, i'm implementing the shortcode in a sidebar on all blog pages.
remove_shortcode( 'credit_tracker_table' );
add_shortcode( 'credit_tracker_table', 'my_credit_tracker_table_shortcode' ) );
function my_credit_tracker_table_shortcode( $atts ) {
extract( shortcode_atts( array(
'attachments' => false
), $atts ) );
if ( $attachments ) {
global $post;
$attachments = get_attached_media( 'image' );
$attachment_ids = array();
foreach ( $attachments as $attachment ) {
$attachment_ids[] = $attachment->ID;
} //$attachments as $attachment
$attachment_ids = implode( ',', $attachment_ids );
$atts[ 'id' ] = $attachment_ids;
} //$attachments
return ( credit_tracker_table_shortcode( $atts ) );
}
Source: https://wordpress.org/support/topic/photo-caption-table-for-attachments-to-current-post
Reactions are currently unavailable