• Resolved kamtcho

    (@kamtcho)


    Hallo, how can i make a default selection Instead filter by to:
    Not in category.

    Could you please give me hint what edit, even in core file.

    Thank you very much.

    Martin

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author webbistro

    (@webbistro)

    Hello Martin,

    Sorry, your question is not clear to me. Can you please describe your need in more details? What do you mean by “default selection”?

    Best,
    -Nadia

    Thread Starter kamtcho

    (@kamtcho)

    Thanks for reply,

    By defauld, in media libraly when install your script i have all images,

    i would like have selected by defalt: –NOT IN MEDIA CATEGORY–

    Thank you for help.

    Sincerely Martin.

    Plugin Author webbistro

    (@webbistro)

    I see now, thanks. The simple solution exists for the grid mode and media popups:

    $( document ).ready( function() {
        $('#media-attachment-media_category-filters').val('not_in').change();
    });

    For the list mode things get complicated.

    Best,
    -Nadia

    Thread Starter kamtcho

    (@kamtcho)

    Grid mode is enough for me.

    Please what file to edit?

    I tryed edit:
    eml-media-grid.js
    eml-medialibrary-options.js

    but no success.

    COuld you hint me a little.

    Thank you for you time.

    Martin

    Thread Starter kamtcho

    (@kamtcho)

    To make it clear what i would need, i am adding img:

    the red circle

    thank you for your time.

    Sincerely Martin

    • This reply was modified 7 years, 4 months ago by kamtcho.
    • This reply was modified 7 years, 4 months ago by kamtcho.
    Thread Starter kamtcho

    (@kamtcho)

    or this will be also OK:

    or this red

    Plugin Author webbistro

    (@webbistro)

    Martin,

    You should add a JS file with this custom code to your theme folder, for example:

    ( function( $ ) {
        $( document ).ready( function() {
            $('#media-attachment-media_category-filters').val('not_in').change();
        });
    })( jQuery );

    You should also enqueue the script in your theme functions.php like this:

    add_action( 'wp_enqueue_scripts', 'YOUR_PREFIX_enqueue_scripts' );
    
    function YOUR_PREFIX_enqueue_scripts() {
        wp_enqueue_script( 'eml-customization', get_template_directory_uri() . '/eml-customization.js' );
    }

    Best,
    -Nadia

    Thread Starter kamtcho

    (@kamtcho)

    Hallo,

    i tryed create file:

    not_in_c.js

    put this file into my theme folder. Put into file the first code you posted.

    The second code i put into functions.php and changed:

    add_action( 'wp_enqueue_scripts', 'not_in_c_enqueue_scripts' );
    
    function not_in_c_enqueue_scripts() {
        wp_enqueue_script( 'not_in_c', get_template_directory_uri() . '/not_in_c.js' );
    }

    Is prefilx same as first part of created js.file?
    And this way it now work for me.

    Plugin Author webbistro

    (@webbistro)

    Martin,

    The prefix is totally up to you. Glad to know you have managed to make it work.

    Best,
    -Nadia

    Thread Starter kamtcho

    (@kamtcho)

    Hallo,
    unfortunatelly, it does not work for me. Still same. All images i see.

    I was little confused, so I though that something with prefix i made wrong.

    Sincerely Martin

    Plugin Author webbistro

    (@webbistro)

    Hello Martin,

    Sorry,

    (1) better use $(window).on( 'load', function(){} );

    ( function( $ ) {
    
        $( window ).on( 'load', function() {
            $('#media-attachment-media_category-filters').val('not_in').change();
        });
    })( jQuery );

    (2) should be admin_enqueue_scripts

    add_action( 'admin_enqueue_scripts', 'not_in_c_enqueue_scripts' );
    
    function not_in_c_enqueue_scripts() {
        wp_enqueue_script( 'not_in_c', get_template_directory_uri() . '/not_in_c.js' );
    }

    Best,
    -Nadia

    Thread Starter kamtcho

    (@kamtcho)

    Hallo,

    now it works like a charm.

    Thank you very much for your time.

    All the best.

    Sincerely Martin

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Default selection’ is closed to new replies.