Add an attachment feature to comments

Here is my suggestion: Just download this Comment Images plugin. As of now it only support images. But upload work with all file types. So just make a little tweak like this. So it will display attachment link. Replace line 245 from $comment->comment_content .= ‘<img src=”‘ . $comment_image[‘url’] . ‘” alt=”” />’; to $comment->comment_content .= … Read more

Add audio attachment link to RSS

You can add this part into your function: $audios =& get_children(‘post_type=attachment&post_parent=”.$post->ID.”&post_mime_type=audio’ ); foreach ( $audios as $id => $audio ){ $content.='<a href=”‘.wp_get_attachment_url($id).'” target=”_blank”>’.$audio->post_title.'</a> ‘; } to add audio links into your feed content. I’m using get_children() here, you can read more about it here: http://codex.wordpress.org/Function_Reference/get_children Edit: Here is the whole function: function featuredtoRSS($content) { global … Read more

How to create a multidimensional array with multiple loops

I don’t think this is a restrict WordPress question, but you might try $args = array( ‘posts_per_page’ => ‘-1’, ‘post_type’ => ‘work’, ‘orderby’ => ‘ID’, ‘order’ => ‘DESC’, ); $data = array(‘work’ => array()); $loop = new WP_Query($args); if( $loop->have_posts() ): while( $loop->have_posts() ): $loop->the_post(); $id = $loop->post->ID; $attachments=array(); if(get_field(‘work’)): while(has_sub_field(‘work’)): $attachment_id = get_sub_field(‘image’); $caption … Read more

Retrieve Image Attachments Getting Post Thumbnail Image First

First, exclude the featured image (= post thumbnail) from the query, then set up the posts array as combination of the featured image and the other images. Put this directly below $args = … and above $attachments = …: if (has_post_thumbnail($post->ID)) { $featured_image = get_post_thumbnail_id($post->ID); $args[‘exclude’] = $featured_image; $attachments = array(get_post($featured_image)) + get_posts($args); } else

Get all attachments by custom taxonomy – term

To get all images from the same term you can use WP_Query with the “tax_query” argument: $args = array( ‘post_status’ => ‘inherit’, ‘posts_per_page’ => -1, ‘post_type’ => ‘attachment’, ); $args[‘tax_query’] = array( array( ‘taxonomy’ => ‘YOUR_CUSTOM_TAXONOMY’, ‘terms’ => array( ‘YOUR_CUSTOM_TAXONOMY_TERM’ ), ‘field’ => ‘slug’, ), ); $the_query = new WP_Query( $args ); if ( $the_query->have_posts() … Read more

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