Forum Replies Created
-
AuthorPosts
-
Thank you Shiri,
Once again your support is excellent. Everything is working great.Hmm… I successfully made the change but it didn’t fix it. Any other ideas? When I take a look at the page source in a browser, it looks like the problem is that the <div class=”news-box”> container isn’t getting closed with a </div> after each post. Instead, each new post is getting inserted into the <div class=news-box> element of the post before it, and all the closing tags are just being stacked at the end of the section.
Here’s the latestposts code from my custom-functions.php file:
function latestpostsoutput_func( $atts ){ extract( shortcode_atts( array( 'show' => '', ), $atts ) ); $postoutput = ''; wp_reset_query(); $n = 0; query_posts( array( 'posts_per_page'=>$show, 'post__not_in' => get_option('sticky_posts') ) ); if ( have_posts() ) : while ( have_posts() ) : the_post(); $n++; if( $n%2==0 ) $nomgn = 'last'; else $nomgn = ' '; if ( has_post_thumbnail()) { $large_imgSrc = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large'); $imgUrl = $large_imgSrc[0]; }else{ $imgUrl = get_template_directory_uri().'/images/img_404.png'; } $postoutput .= '<div class="news-box '.$nomgn.'"> <div class="news-thumb"> <a href="'.get_the_permalink().'"><img src="'.$imgUrl.'" alt=" " /></a> </div> <div class="news"> <div class="date-news"> <span class="newsdate">'.get_the_time('d').'</span> <span>'.get_the_time('M').'</span> </div> <a href="'.get_permalink().'"><h4>'.get_the_title().'</h4></a> '.wp_trim_words( get_the_content(), 20, '' ).' </div> </div>'; $postoutput .= ''.(($n%2==0) ? '<div class="clear"></div>' : ''); endwhile; endif; wp_reset_query(); return $postoutput; } add_shortcode( 'latestposts', 'latestpostsoutput_func' );
Thanks for the help, but I was able to figure it out on my own.
In the index.php file I replaced ‘<div class=”thumb_four_page”><?php the_post_thumbnail();?></div>’ with ‘<div class=”thumb_four_icon”>/images/donation-image-<?php echo $fx; ?>.png” alt=”” /></div>’
It would be great if there were an easier way to do this in future updates. Thanks again!
-
AuthorPosts