Only show featured image on exerpt and exclude images in post

you need to change the_content(‘Read more’); to the_excerpt(); Then in your functions.php file add_filter(‘excerpt_more’, ‘custom_read_more_link’); function custom_read_more_link($more) { return ‘<a href=”‘get_permalink().'”>Read More</a>’; } Also make sure that you’re calling wp_reset_query() after the while loop. This will achieve what you’re trying to do. A personal suggestion: Please don’t use query_posts, instead create a new instance of … Read more

How to change image’s author via a function when using GravityForms uploader? [closed]

add_action(“gform_user_registered”, “image_author”, 10, 4); function image_author($user_id, $config, $entry, $user_pass) { $post_id = $entry[“post_id”]; $args = array( ‘post_parent’ => $post_id, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’ ); $attachments = get_posts($args); if($attachments) : foreach ($attachments as $attachment) : setup_postdata($attachment); $the_post = array(); $the_post[‘ID’] = $attachment->ID; $the_post[‘post_author’] = $user_id; wp_update_post( $the_post ); endforeach; endif; }

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 change the order of elements within a post?

Something like (in your single.php) <?php while (have_posts()): the_post(); ?> <article id=”post-<?php the_ID(); ?>” <?php post_class(); ?>> <time class=”post-time” datetime=”<?php the_time(‘Y-m-d’); ?>”><?php the_time(‘F j, Y’); ?></time> <?php if (has_post_thumbnail()): ?> <?php $thumbnail_image = get_posts( array( ‘p’ => get_post_thumbnail_id($post->ID), ‘post_type’ => ‘attachment’, ) ); ?> <p class=”thumbnail-caption”> <?php echo $thumbnail_image[0]->post_excerpt; ?></p> <?php the_post_thumbnail(‘full’); ?> <?php endif; … Read more

Attachment image single page

Refer to the Template Hierarchy for attachment post types: `$mimetype.php $attachment.php single-attachment.php single.php index.php So for an image attachment, name your template file image.php. Then, to link to the single post view for an attachment, you would link to it like any other post: get_the_permalink( $postid ).

Specific Days, Specific image on Front Page

Unless i missunderstood you, This should be easy to do without using a plugin… Embed this in your functions.php: function echoDayImage() { // GET CURRENT DAY $currentDay = get_the_time(‘l’); // CHECK DAY AND ECHO SUITABLE IMAGE if($currentDay = ‘Sunday’) {echo TEMPLATEPATH.’/images/Sunday.jpg’;} elseif($currentDay = ‘Monday’) {echo TEMPLATEPATH.’/images/Monday.jpg’;} elseif($currentDay = ‘Tuesday’) {echo TEMPLATEPATH.’/images/Tuesday.jpg’;} elseif($currentDay = ‘Wednesday’) {echo … Read more