• Resolved darren502

    (@darren502)


    I’m very fairly new when it comes to plugins on WordPress. Currently I’m using a plugin called ” Enhanced Media Library ” for my wordpress application. The reason why I’m using this plugin is because my site will be dealing with over 1000 pics and I thought it best to categorized my pictures.

    In addition to the above plugin I’m also using another plugin called ” Search and Filter “. My reasons for using this plugin is that I want to create a customize search so that my users would be able to pull up pictures based on categories.

    However when I installed the second plugin…the categories that I created via the Enhanced Media Library plugin are not appearing. The list of categories that I am able to select from via the ” search and filter ” plugin are the categories from my posts.

    Has anyone have any tips to help me out. In addition can anyone provide me with a plugin to pull pictures from the database via custom categories.

    https://wordpress.org/plugins/enhanced-media-library/

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

    (@webbistro)

    Hello @darren502,

    I just tested “Search and Filter” and it perfectly works with EML taxonomies.

    I used [searchandfilter taxonomies="media_category"] shortcode, where media_category is my custom category slug. If you created some taxonomies with EML you can see their slugs on that page where you created them.

    Please also read this http://docs.designsandcode.com/search-filter/#how-to-use

    To pull pictures via custom categories you have to use WP_Query http://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters

    Nadia

    Thread Starter darren502

    (@darren502)

    Thank you for your reply, I’ll try and see what I can do.

    Btw you were right about using wp_query to get the pictures from the databses. I didn’t know wp_query even existed.lol I only know about SQL. Like i said before I’m new to wordpress.

    Thread Starter darren502

    (@darren502)

    Sorry to be of bother but, I’m getting through half-way through this task. I know how to pull up pictures from the wordpress database via wp-query. I was able to get some code that allowed me to pull images from the database. Of course, to use with EML i would have to customize it.

    Here it is…

    /* Function here used to get images from media library  */
    function get_images_from_media_library() {
        $args = array(
            'post_type' => 'attachment',
            'post_mime_type' =>'image',
            'post_status' => 'inherit',
            'posts_per_page' => 1,
            'orderby' => 'rand'
    
        );
        $query_images = new WP_Query( $args );
        $images = array();
        foreach ( $query_images->posts as $image) {
            $images[]= $image->guid;
        }
        return $images;
    }
    
    function display_images_from_media_library() {
    
    	$imgs = get_images_from_media_library();
    	$html = '<div id="media-gallery">';
    
    	foreach($imgs as $img) {
    
    		$html .= '<img src="' . $img . '" alt="" height="" width=""/>';
    
    	}
    
    	$html .= '</div>';
    
    	return $html;
    
    }
    
    /* End of functions to get images */

    However in order to get images from a specific category i’ve tried the following…

    function get_images_from_media_library() {
        $args = array(
            'category_name' => 'mount-irvine',

    I’m not sure if I’m using this category parameter correctly. When I read the documentation it stated that it is to be used with a category slug(not Name) I used the slug that I created with EML. I wonder is that correct??

    Plugin Author webbistro

    (@webbistro)

    Thread Starter darren502

    (@darren502)

    Thanks, I’ll take a look at it.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Search plugins and media categories’ is closed to new replies.