darren502
Forum Replies Created
-
Forum: Plugins
In reply to: [Enhanced Media Library] Search plugins and media categoriesThanks, I’ll take a look at it.
Forum: Plugins
In reply to: [Enhanced Media Library] Search plugins and media categoriesSorry 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??
Forum: Plugins
In reply to: [Enhanced Media Library] Search plugins and media categoriesThank 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.