• Resolved gamerwithadegree

    (@gamerwithadegree)


    Hi,

    I currently insert galleries into a ACF WYSWYG field using the following shortcode:

    [ngg src=”galleries” ids=”202″ display=”basic_thumbnail” images_per_page=”20″]

    The gallery is then displayed on a separate page created using WordPress endpoint.

    However, I would like to also display the gallery images on the main post page but with less images per page. I already have hundreds of galleries so pasting a new shortcode with a new images_per_page value into a new ACF field ins’t an option.

    I have tried a few methods using shortcode_atts and shortcode_atts_{$shortcode} but I can’t seem to get the images_per_page value to change.

    Do you know of a realiable way to essentially alter the images_per_page attribute and change it using PHP? I want to be able to set the number of images per page to 6 for every gallery dislayed ont he main post page. And have the original amount displayed on the page created suing the endpoint?

    I hope this makes sense adn thanks for your help.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Imagely

    (@imagely)

    Hi @gamerwithadegree,

    We are sorry, but, unfortunately, it doesn’t look like NGG has such a filter at this time and shortcode_atts_ngg wouldn’t help much in programmatically changing images_per_page attribute specifically.

    The good news is that we look forward into allowing an action in one of the future NGG versions that should enable passing values for the shortcode attributes like in the example from below:

    add_action( ‘ngg_displayed_gallery_construct’, function ( $displayed_gallery ) {
    if ( is_archive() ) {
    $displayed_gallery->display_settings[‘images_per_page’] = 6;
    }
    } );

    • This reply was modified 1 year, 4 months ago by Imagely.
    • This reply was modified 1 year, 4 months ago by Imagely.
    Thread Starter gamerwithadegree

    (@gamerwithadegree)

    Hi, Thank you so much for your reply I am glad you are adding the add_action. Can you tell me which version this will be in? I noticed 2 updates to NGG recently, just wondering if it is in one of them.

    Thank you.

    Plugin Support Mihai Ceban

    (@mihaiimagely)

    Hi @gamerwithadegree,

    Thanks for asking us. You can use the add_action with NGG 3.50 and newer versions.

    • This reply was modified 1 year, 3 months ago by Mihai Ceban.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Replace ngg shortcode value using a function’ is closed to new replies.