Digital experiences for all disciplines
New Landing › How can we help? › Themeforest Theme Support › Neighborhood › Move post title above featured image
New Landing › How can we help? › Themeforest Theme Support › Neighborhood › Move post title above featured image
- This topic has 1 reply, 2 voices, and was last updated 9 years by Mohammad – SUPPORT.
-
Posted in: Neighborhood
-
July 9, 2015 at 4:14 am #192991
I’m using the blog – standard module to display blog posts on my home page
Currently, the post title appears below the featured image; the date and comments link appears to the right of the featured image, and the category is not shown.
What can I change so that they post title, date, and category appears above the featured image, and the category appears below the featured image when using the blog – standard module?
Thank you.
July 9, 2015 at 7:26 am #193006Hi,
Please paste this code at functions.php of child theme.function sf_get_post_item($postID, $blog_type, $show_title = "yes", $show_excerpt = "yes", $show_details = "yes", $excerpt_length = "20", $content_output = "excerpt", $show_read_more = "no") { $post_item = ""; $post_format = get_post_format($postID); global $sidebars; $post_format = get_post_format(); if ( $post_format == "" ) { $post_format = 'standard'; } $post_title = get_the_title(); $post_author = get_the_author_link(); $post_date = get_the_date(); $post_categories = get_the_category_list(', '); $post_comments = get_comments_number(); $post_permalink = get_permalink(); $custom_excerpt = sf_get_post_meta($postID, 'sf_custom_excerpt', true); $post_excerpt = ''; if ($content_output == "excerpt") { if ($custom_excerpt != '') { $post_excerpt = custom_excerpt($custom_excerpt, $excerpt_length); } else { if ($post_format == "quote") { $post_excerpt = get_the_content_with_formatting(); } else { $post_excerpt = excerpt($excerpt_length); } } } else { $post_excerpt = get_the_content_with_formatting(); } if ($post_format == "chat") { $post_excerpt = sf_chat_post($postID); } $post_item = $thumb_image = $thumb_width = $thumb_height = $bordered_thumb_width = $bordered_thumb_height = $video = $video_height = $bordered_video_height = $item_class = $link_config = $item_icon = ''; if ($blog_type == "mini") { if ($sidebars == "no-sidebars") { $thumb_width = 446; $thumb_height = NULL; $video_height = 335; } else { $thumb_width = 290; $thumb_height = NULL; $video_height = 218; } } else if ($blog_type == "masonry") { if ($sidebars == "both-sidebars") { $item_class = "span3"; } else { $item_class = "span4"; } $thumb_width = 480; $thumb_height = NULL; $video_height = 360; } else { if ($sidebars == "both-sidebars") { if ($show_details == "yes") { $standard_post_width = "span5"; } else { $standard_post_width = "span6"; } } else if ($sidebars == "right-sidebar" || $sidebars == "left-sidebar" || $sidebars == "one-sidebar") { if ($show_details == "yes") { $standard_post_width = "span6"; } else { $standard_post_width = "span7"; } } else { if ($show_details == "yes") { $standard_post_width = "span10"; } else { $standard_post_width = "span11"; } } $thumb_width = 970; $thumb_height = NULL; $video_height = 728; } $thumb_type = sf_get_post_meta($postID, 'sf_thumbnail_type', true); $thumb_image = rwmb_meta('sf_thumbnail_image', 'type=image&size=full'); $thumb_video = sf_get_post_meta($postID, 'sf_thumbnail_video_url', true); $thumb_gallery = rwmb_meta( 'sf_thumbnail_gallery', 'type=image&size=blog-image' ); $thumb_link_type = sf_get_post_meta($postID, 'sf_thumbnail_link_type', true); $thumb_link_url = sf_get_post_meta($postID, 'sf_thumbnail_link_url', true); $thumb_lightbox_thumb = rwmb_meta( 'sf_thumbnail_image', 'type=image&size=large' ); $thumb_lightbox_image = rwmb_meta( 'sf_thumbnail_link_image', 'type=image&size=large' ); $thumb_lightbox_video_url = sf_get_post_meta($postID, 'sf_thumbnail_link_video_url', true); foreach ($thumb_image as $detail_image) { $thumb_img_url = $detail_image['url']; break; } if (!$thumb_image) { $thumb_image = get_post_thumbnail_id(); $thumb_img_url = wp_get_attachment_url( $thumb_image, 'full' ); } $thumb_lightbox_img_url = wp_get_attachment_url( $thumb_lightbox_image, 'full' ); $item_figure = $link_config = ""; // LINK TYPE VARIABLES if ($thumb_link_type == "link_to_url") { $link_config = 'href="'.$thumb_link_url.'" class="link-to-url"'; $item_icon = "link"; } else if ($thumb_link_type == "link_to_url_nw") { $link_config = 'href="'.$thumb_link_url.'" class="link-to-url" target="_blank"'; $item_icon = "link"; } else if ($thumb_link_type == "lightbox_thumb") { $link_config = 'href="'.$thumb_img_url.'" class="lightbox" data-rel="ilightbox['.$post_ID.']"'; $item_icon = "search"; } else if ($thumb_link_type == "lightbox_image") { $lightbox_image_url = ''; foreach ($thumb_lightbox_image as $image) { $lightbox_image_url = $image['full_url']; } $link_config = 'href="'.$lightbox_image_url.'" class="lightbox" data-rel="ilightbox['.$post_ID.']"'; $item_icon = "search"; } else if ($thumb_link_type == "lightbox_video") { $link_config = 'href="'.$thumb_lightbox_video_url.'" class="lightbox" data-rel="ilightbox['.$postID.']"'; $item_icon = "facetime-video"; } else { $link_config = 'href="'.$post_permalink.'" class="link-to-post"'; $item_icon = "file-o"; } if ($show_title) { if ($post_format == "link") { $post_item .= '<h2 itemprop="name headline">'.sf_link_post($postID).'</h2>'; } else { $post_item .= '<h2 itemprop="name headline"><a href="'.$post_permalink.'">'. $post_title .'</a></h2>'; } } // THUMBNAIL MEDIA TYPE SETUP if ($thumb_type != "none") { $item_figure .= '<figure>'; if ($thumb_type == "video") { $video = video_embed($thumb_video, $thumb_width, $video_height); $item_figure .= $video; } else if ($thumb_type == "slider") { $item_figure .= '<div class="flexslider thumb-slider"><ul class="slides">'; foreach ( $thumb_gallery as $image ) { $item_figure .= "<li><a ".$link_config."><img src='{$image['url']}' width='{$image['width']}' height='{$image['height']}' alt='{$image['alt']}' /></a></li>"; } $item_figure .= '</ul></div>'; } else { $image = aq_resize( $thumb_img_url, $thumb_width, $thumb_height, true, false); $image_title = sf_featured_img_title(); if ($image) { $item_figure .= '<a '.$link_config.'>'; if ($blog_type != "standard") { $item_figure .= '<div class="overlay"><div class="thumb-info">'; $item_figure .= '<i class="fa-'.$item_icon.'"></i>'; $item_figure .= '</div></div>'; } $item_figure .= '<img itemprop="image" src="'.$image[0].'" width="'.$image[1].'" height="'.$image[2].'" alt="'.$image_title.'" />'; $item_figure .= '</a>'; } } $item_figure .= '</figure>'; } // MASONRY STYLING if ($blog_type == "masonry") { if ($post_format == "quote") { $post_item .= '<div class="quote-display"><i class="fa-quote-left"></i></div>'; } else { $post_item .= $item_figure; } $post_item .= '<div class="details-wrap">'; if ($show_title == "yes") { if ($post_format == "link") { $post_item .= '<h4 itemprop="name headline">'.sf_link_post($postID).'</h4>'; } else { $post_item .= '<h4 itemprop="name headline"><a href="'.$post_permalink.'">'.$post_title.'</a></h4>'; } } // POST EXCERPT if ($post_excerpt != "0" && $show_excerpt == "yes") { $post_item .= '<div class="excerpt" itemprop="description">'. $post_excerpt .'</div>'; } if ($show_read_more == "yes") { $post_item .= '<a class="read-more" href="'.$post_permalink.'">'.__("Read more", "swiftframework").'<i class="fa-angle-right"></i></a>'; } $post_item .= '</div>'; // POST DETAILS if ($show_details == "yes") { $post_item .= '<div class="post-item-details clearfix">'; $post_item .= '<span class="post-date" itemprop="datePublished">'.$post_date.'</span>'; $post_item .= '<div class="comments-likes">'; if ( comments_open() ) { $post_item .= '<a href="'.$post_permalink.'#comment-area"><i class="fa-comments"></i><span>'. $post_comments .'</span></a> '; } if (function_exists( 'lip_love_it_link' )) { $post_item .= lip_love_it_link(get_the_ID(), '<i class="fa-heart"></i>', '<i class="fa-heart"></i>', false); } $post_item .= '</div>'; $post_item .= '</div>'; } // MINI STYLING } else if ($blog_type == "mini") { $post_item .= $item_figure; $post_item .= '<div class="blog-details-wrap">'; if ($show_title == "yes") { if ($post_format == "link") { $post_item .= '<h3 itemprop="name headline">'.sf_link_post($postID).'</h3>'; } else { $post_item .= '<h3 itemprop="name headline"><a href="'.$post_permalink.'">'. $post_title .'</a></h3>'; } } if ($show_details == "yes") { $post_item .= '<div class="blog-item-details">'. sprintf(__('By <a href="%2$s">%1$s</a> on %3$s', 'swiftframework'), $post_author, get_author_posts_url(get_the_author_meta( 'ID' )), $post_date) .'</div>'; $post_item .= '<div class="comments-likes">'; if ( comments_open() ) { $post_item .= '<a href="'.$post_permalink.'#comment-area"><i class="fa-comments"></i><span>'. $post_comments .'</span></a> '; } if (function_exists( 'lip_love_it_link' )) { $post_item .= lip_love_it_link(get_the_ID(), '<i class="fa-heart"></i>', '<i class="fa-heart"></i>', false); } $post_item .= '</div>'; } if ($show_excerpt == "yes") { if ($post_format == "quote") { $post_item .= '<div class="quote-excerpt heading-font" itemprop="description">'. $post_excerpt .'</div>'; } else { $post_item .= '<div class="excerpt" itemprop="description">'. $post_excerpt .'</div>'; } } if ($show_read_more == "yes") { $post_item .= '<a class="read-more" href="'.$post_permalink.'">'.__("Read more", "swiftframework").'<i class="fa-angle-right"></i></a>'; } $post_item .= '</div>'; // STANDARD STYLING } else { $post_item .= '<div class="row">'; // open row if ($sidebars == "no-sidebars") { $post_item .= '<div class="standard-post-author span1">'; if(function_exists('get_avatar')) { $post_item .= '<div class="author-avatar"><a href="'.get_author_posts_url( get_the_author_meta( 'ID' ) ).'">'. get_avatar(get_the_author_meta('ID'), '164') .'</a></div>'; } $post_item .= '<span class="standard-post-author-name" itemprop="author">'.__("Posted by", "swiftframework").' '.$post_author.'</span>'; $post_item .= '</div>'; } else if ($sidebars == "right-sidebar" || $sidebars == "left-sidebar" || $sidebars == "one-sidebar") { $post_item .= '<div class="standard-post-author span1">'; if(function_exists('get_avatar')) { $post_item .= '<div class="author-avatar"><a href="'.get_author_posts_url( get_the_author_meta( 'ID' ) ).'">'. get_avatar(get_the_author_meta('ID'), '164') .'</a></div>'; } $post_item .= '<span class="standard-post-author-name" itemprop="author">'.__("Posted by", "swiftframework").' '.$post_author.'</span>'; $post_item .= '</div>'; } $post_item .= '<div class="standard-post-content '.$standard_post_width.'">'; // open standard-post-content if ($post_format == "quote") { $post_item .= '<div class="quote-display"><i class="fa-quote-left"></i></div>'; } else { $post_item .= $item_figure; if ($show_title) { if ($post_format == "link") { $post_item .= '<h2 itemprop="name headline">'.sf_link_post($postID).'</h2>'; } else { $post_item .= '<h2 itemprop="name headline"><a href="'.$post_permalink.'">'. $post_title .'</a></h2>'; } } } if ($show_excerpt == "yes") { if ($post_format == "quote") { $post_item .= '<div class="quote-excerpt heading-font" itemprop="description">'. $post_excerpt .'</div>'; } else { $post_item .= '<div class="excerpt" itemprop="description">'. $post_excerpt .'</div>'; } } if ($show_read_more == "yes") { $post_item .= '<a class="read-more" href="'.$post_permalink.'">'.__("Read more", "swiftframework").'<i class="fa-angle-right"></i></a>'; } $post_item .= '</div>'; // close standard-post-content if ($show_details == "yes") { $post_item .= '<div class="standard-post-details span1">'; // open standard-post-details if ($sidebars == "both-sidebars") { $post_item .= '<div class="standard-post-author">'; if(function_exists('get_avatar')) { $post_item .= '<div class="author-avatar"><a href="'.get_author_posts_url( get_the_author_meta( 'ID' ) ).'">'. get_avatar(get_the_author_meta('ID'), '164') .'</a></div>'; } $post_item .= '<span class="standard-post-author-name" itemprop="author">'.__("Posted by", "swiftframework").' '.$post_author.'</span>'; $post_item .= '</div>'; } $post_item .= '<span class="standard-post-date" itemprop="datePublished">'.$post_date.'</span>'; $post_item .= '<div class="comments-likes">'; if ( comments_open() ) { $post_item .= '<div class="comments-wrapper"><a href="'.$post_permalink.'#comment-area"><i class="fa-comments"></i><span>'. $post_comments .'</span></a></div>'; } if (function_exists( 'lip_love_it_link' )) { $post_item .= lip_love_it_link(get_the_ID(), '<i class="fa-heart"></i>', '<i class="fa-heart"></i>', false); } $post_item .= '</div>'; $post_item .= '</div>'; // close standard-post-details } $post_item .= '</div>'; // close row } return $post_item; }
Thanks
Mohammad -
Posted in: Neighborhood
You must be logged in and have valid license to reply to this topic.