How to automatically populate a gallery with images attached to posts of one category?

In form of a shortcode to render a default WordPress shortcode including all attachments of the given categories: /** * Usage: [catgallery cat=”4,5″] * Attribute: array of category IDs */ add_shortcode(‘catgallery’, ‘wpse_70989_cat_gallery_shortcode’); function wpse_70989_cat_gallery_shortcode($atts) { // $return = ”; // DEBUG: enable for debugging $arr = array(); $cat_in = explode( ‘,’, $atts[‘cat’] ); $catposts = … Read more

How to Find a Gallery’s ID

The shortcode supports specifying the gallery’s id by supplying the id parameter. More on this in the documentation. However, using id might be contra productive if you wish to use two different styles of galleries across your site, in which case you would need to use the same style for a whole lot of #ids … Read more

limit number of images shown from gallery

Try this: $args = array( ‘name’=>’header-images’, ‘posts_per_page’ => 4, ‘orderby’ => ‘rand’ ); i.e. use posts_per_page instead of numberposts if you want to use query_posts() according to the the Codex page: http://codex.wordpress.org/Function_Reference/query_posts Edit: Here is one idea – fetch the gallery shortcode ids from a page content with a given slug: /* * Get an … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)