Good to hear from you again. Thanks for including the source text of your shortcode and the additions you’ve tried.
Have a look at the “A Paginated Galley” example in the Settings/Media Library Assistant Documentation tab. As the example shows, you must have two separate [mla_gallery]
shortcodes: one for the gallery and one for the pagination controls. The mla_output
parameter changes the output from a gallery (the default) to pagination controls.
For your example, try something like:
[mla_gallery posts_per_page=8 size="side-images" mla_caption="{+title+}" columns="4" ids="7852,7850,7821,7156,7173,7194,7497,7687,7816,7803,7805,7806,7796,7795,7794,7786,7736,7733,7727,7530,7511,7577"]
[mla_gallery posts_per_page=8 mla_output="paginate_links,prev_next" ids="7852,7850,7821,7156,7173,7194,7497,7687,7816,7803,7805,7806,7796,7795,7794,7786,7736,7733,7727,7530,7511,7577"]
I moved the ids=
parameter to the end so you can more easily see the differences between the shortcodes. The mla_output=
parameter replaces the size="side-images" mla_caption="{+title+}" columns="4"
parameters because size, caption and columns do not apply to pagination controls. The data selection and posts_per_page
must be the same for both shortcodes.
You also asked “is there a way to remove the hypens that WordPress automatically adds to the titles of images with the bulk edit feature?” There are two example plugins in the /media_library_assistant/examples/
directory that solve this type of problem:
- mla-file-name-mapping-hooks-example.php.txt
- mla-mapping-hooks-example.php.txt
The first example is closer to your needs, but it uses the file name to replace the Title instead of just cleaning the existing Title. For your application, replace the mla_mapping_updates_filter
function with this code:
public static function mla_mapping_updates_filter( $updates, $post_id, $category, $settings, $attachment_metadata ) {
/*
* Clean up the Title field
*/
$my_setting = array(
'data_source' => 'template',
'meta_name' => '([+title+])',
'option' => 'raw'
);
$old_value = trim( MLAOptions::mla_get_data_source( $post_id, 'single_attachment_mapping', $my_setting, NULL ) );
$new_value = str_replace( array( '-', '_', '.' ), ' ', $old_value );
/*
* If $updates[ 'post_title' ], etc. is set, some mapping rule has been set up, so we respect the result.
* If not, use whatever the current value is.
*/
if ( isset( $updates[ 'post_title' ] ) ) {
$old_title = $updates[ 'post_title' ];
} else {
$post = get_post( $post_id );
$old_title = $post->post_title;
}
/*
* If the cleanup has changed the value,
* put the new value in the $updates array.
*/
if ( $old_title != $new_value ) {
$updates[ 'post_title' ] = $new_value;
}
return $updates;
} // mla_mapping_updates_filter
This code replaces hyphen, underscore and period characters with spaces. You can chage the str_replace( array( '-', '_', '.' ), ' ', $old_value )
code as you see fit.
Once that’s done you can use the Map All Attachments, Standard Fields Now button to go back and clean the Title field for your existing items, if that is appropriate. You can use the Media/Assistant Bulk Edit area or the Media/Edit Media screen to make more selective replacements. Look for the Map IPTC/EXIF Metadata button on either of those screens.
I hope that answers both of your questions. I am marking this topic resolved, but if your have any problems or further questions regarding the above suggestions post an update and I will be more specific. Thanks for your continued interest in the plugin.