Home Forums Themes Support Claue Related blog posts Time

Topic Resolution: Resolved
Viewing 4 reply threads
  • Author
    Posts
    • #31397

      Hi Harry,

      Hope you are fine.

      I just realized the related blog posts under the post don’t have the year of publish.

      I thought if the post is for the current year, it doesn’t show the year but saw that your posts year is 2015!

      I think these posts should have the year too.

      And it has different formatting via timing format in the title of the post.

      My localize calendar plugin, override the title time to my country format, but these related posts no.

      We insert the day number before the month like: 17 December 2015

      How can make it totally formatted like the title?

      Regards

      Rahim Vaziri
      CEO & Founder at Look.ir

    • #31400

      Hi Rahim,

      Please add the code to claue-child > functions.php or wait for the next update.

      if ( ! function_exists( 'jas_claue_related_post' ) ) {
      	function jas_claue_related_post() {
      		global $post;
      
      		// Get post's tags
      		$tags = wp_get_post_tags( $post->ID );
      
      		if ( $tags ) {
      			// Get id for all tags
      			$tag_ids = array();
      
      			foreach ( $tags as $tag ) {
      				$tag_ids[] = $tag->term_id;
      			}
      
      			// Build arguments to query for related posts
      			$args = array(
      				'tag__in'             => $tag_ids,
      				'post__not_in'        => array( $post->ID ),
      				'posts_per_page'      => apply_filters( 'jas_claue_related_post_per_page', '5' ),
      				'ignore_sticky_posts' => 1,
      				'orderby'             => 'rand',
      			);
      
      			// Get related post
      			$related = new wp_query( $args );
      
      			$output = '';
      			$output .= '<div class="post-related mt__50">';
      				$output .= '<h4 class="mg__0 mb__30 tu">' . esc_html__( 'Related Articles', 'claue' ) . '</h4>';
      				$output .= '<div class="jas-carousel" data-slick=\'{"slidesToShow": 3,"slidesToScroll": 1, "responsive":[{"breakpoint": 960,"settings":{"slidesToShow": 2}},{"breakpoint": 480,"settings":{"slidesToShow": 1}}]'. ( is_rtl() ? ',"rtl":true' : '' ) .'}\'>';
      					while ( $related->have_posts() ) :
      						// Update global post data
      						$related->the_post();
      
      						$output .= '<div class="item">';
      							if ( has_post_thumbnail() ) {
      								$output .= '<a class="db mb__20" href="' . esc_url( get_permalink() ) . '">';
      									$img = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), 'full' );
      
      									if ( $img[1] >= 370 && $img[2] >= 210 ) {
      										$image = jas_resizer( $img[0], 370, 210, true );
      										$output .= '<img src="' . esc_url( $image ) . '" width="370" height="210" alt="' . get_the_title() . '" />';
      									} else {
      										$output .= '<div class="pr placeholder mb__15">';
      											$output .= '<img src="' . JAS_CLAUE_URL . '/assets/images/placeholder.png" width="370" height="210" alt="' . get_the_title() . '" />';
      											$output .= '<div class="pa tc fs__10">' . esc_html__( 'The photos should be at least 370px x 210px', 'claue' ) . '</div>';
      										$output .= '</div>';
      									}
      								$output .= '</a>';
      							}
      
      							$output .= '<h5 class="mg__0 fs__14"><a class="cd chp" href="' . esc_url( get_permalink() ) . '">' . get_the_title() . '</a></h5>';
      							$output .= '<span class="f__libre">' . get_the_date( 'j F Y' ) . '</span>';
      						$output .= '</div>';
      					endwhile;
      				$output .= '</div>';	
      			$output .= '</div>';
      			
      			// Reset global query object
      			wp_reset_postdata();
      
      			echo apply_filters( 'jas_claue_related_post', $output );
      		}
      	}
      }

      Kind regards

      Harry
      Premium Wordpress themes and plugins, Best WooCommerce theme https://themeforest.net/user/janstudio/portfolio?ref=janstudio

    • #31406

      Perfect Harry.

      Thank you.

      Rahim Vaziri
      CEO & Founder at Look.ir

    • #31407

      Hi Harry,

      I see this warning on your site: http://prntscr.com/nt9jyn

      Regards

      Rahim Vaziri
      CEO & Founder at Look.ir

    • #31408

      Hi Rahim,

      Thank you for report.

      Harry
      Premium Wordpress themes and plugins, Best WooCommerce theme https://themeforest.net/user/janstudio/portfolio?ref=janstudio

Viewing 4 reply threads

You must be logged in to reply to this topic.