Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter back2music

    (@back2music)

    Hi John and thanks for your quick reply!
    Please let me know if I got it right – the htaccess redirection code above has no mistakes and it should work under normal circumstances?

    Thread Starter back2music

    (@back2music)

    Hello Sayontan!

    Just in case you interested, i have found a nice way to use dropdown in an attachement categories gallery page using URL query strings. It utilises the wordpress function ‘wp_dropdown_categories’ and a short script right in the gallery page-id.php. Here is the code:

    <?php $linkParam = sanitize_text_field( $_GET['acat'] ); 
    wp_dropdown_categories(array(
    'id' => 'drop',
    'exclude' => '2395',
    'hierarchical' => true,
    'order' => 'ASC',
    'orderby' => 'name',
    'show_count' => 1,
    'show_option_none' => 'Choose a category',
    'taxonomy' => 'attachment_category',
    'selected' => $linkParam, ) ); ?>

    <script>
    let dropdown = document.getElementById('drop');
    let selIndex = new URL (window.location.href).searchParams.get('acat');
    dropdown.addEventListener("change", onCatChange);

    function onCatChange() {
    let selIndex = dropdown.options[dropdown.selectedIndex].value;
    location.href ="look?acat="+selIndex; }
    </script>

    <?php echo do_shortcode('[gallery style="random" category="' . $linkParam . '" main_size="full" order="DESC" orderby="ID" tile_size="full" link="file"]');?>

    It works perfectly with the Media Library Categories plugin. It also works fine when the gallery page is opened by an external link with a query string ‘?acat=X’ where X is the ID of the category you want the gallery page to show.
    Thank you once again for your kind assistance, it really helped me to resolve the problem. Have a good day!

    Thread Starter back2music

    (@back2music)

    I found out that accordions are based on CSS display:block/none and tested the feature. A display:none gallery loads as fast as a blank page and only starts loading images after selecting “display:block”. So, as far as I can tell, the idea works fine and I can use it with my dropdown.
    Thank you again!

    Thread Starter back2music

    (@back2music)

    Thanks for the tip!
    I just trying to device a simple solution to print galleries on a page using dropdown where a user could select and see different attachment categories from my media library.
    For now I coded a dropdown using JS, but still have no idea how to use it to change category value in shortcode.
    I’m not sure if I should ask your advice on it in this topic though.

    Thread Starter back2music

    (@back2music)

    I found the cause of the problem, it was my mistake – I just forgot to load the footer in the page-php. Everything work fine now, sorry to bother you with trifles.

    Thread Starter back2music

    (@back2music)

    I understand, no problem, thanks!

    Another question, if you don’t mind. I print a gallery directly from a page-id-template like so:
    <?php echo do_shortcode('[gallery category="200"]'); ?>
    and everything goes fine, but as soon as I change it to
    <?php echo do_shortcode('[gallery category="200" style="random"]'); ?>
    I get a blank area instead of the page content.
    Interesting that when if I’m moving a mouse over the blank area I can see the gallery links in the left bottom corner of the browser. The links open in a new page on click, as if the gallery plugin wasn’t there at all. The same Photonic code works fine inside the page.
    Is there a way to print Photonic gallery using PHP or may be JS?

    Thread Starter back2music

    (@back2music)

    Sorry, that was my mistake! I found that I was using “attachment_category” instead of just “category” shortcode. With the latter everything works fine.
    PS – it’s weird that [gallery] works with the wrong option at all, so I didn’t notice it right away.

    Thread Starter back2music

    (@back2music)

    Thank you for your lightning fast reply!
    #1 – are you planning to add the Mosaic Trigger width and Random Tile height options for individual gallery shortcode?
    #2 – tile_size option works perfectly, thanks!

Viewing 8 replies - 1 through 8 (of 8 total)