This topic has 3 replies, 2 voices, and was last updated 10 years by Abe.

  • Author
  • #8008
     rota299
    Participant

    I need to change the “kleo_articles” shortcode or another shortcode to put my posts in this layout: https://drive.google.com/file/d/0Bzqs439iIKtxeWhWMjdob2V4bjg/edit?usp=sharing

    #8095
     Abe
    Keymaster

    Hi, That looks more like [kleo_posts_carousel] but you need to define your own shortcode based on that. The code for the shortcode is located in: wp-content/themes/sweetdate/framework/shortcodes/shortcodes.php

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #8153
     rota299
    Participant

    Hi Abe,
    yes its look like carousel, really.

    but im not a programmer, i dont have any idea how to do that…can you help me?
    I just need a shortcode like the carousel ones, but with this layout

    #8238
     Abe
    Keymaster

    Hi,
    For custom work you should hire a programmer from microlancer for example.
    Your shortcode should be something like this(added to functions.php), you need to change it if is the case

    COPY CODE
    
    function kleo_my_posts( $atts, $content = null ) {
    		extract(shortcode_atts(array(
    								'cat' => 'all',
    								'limit' => 9,
    								'post_types' => 'post',
    								'post_formats' => 'image,gallery,video'
    		), $atts));
    
    		$output = '<div class="row">';
    
    		$args = array();
    		if ((int)$cat != 0)
    		{
    				$args['cat'] = $cat;
    		}
    		if ((int)$limit != 0)
    		{
    			 $args['posts_per_page'] = $limit; 
    		}
    
    		$args['post_type'] = explode(',', $post_types); 
    
    		$formats = explode(',',$post_formats);
    		if (is_array($formats) && !in_array('all', $formats))
    		{
    				foreach($formats as $format)
    				{
    						$terms_query[] = 'post-format-'.$format;
    				}
    				$args['tax_query'] = array(
    						array(
    						'taxonomy' => 'post_format',
    						'field' => 'slug',
    						'terms' => $terms_query
    						)
    				);
    		}
    
    		$latestPosts = new WP_Query(apply_filters('kleo_posts_carousel_args',$args));
    
    		while ($latestPosts->have_posts()) : $latestPosts->the_post();
    
    				switch (get_post_format()) {
    						case 'video':
    								$video = get_cfield('embed');
    								if (!empty($video)) 
    								{
    										$output .= '<div class="four columns">';
    										$output .= wp_oembed_get($video);
    
    										$output .= '<h4>'.get_the_title().'</h4>';
    										$output .= '<p>'.  word_trim(get_the_excerpt(), 15, '...').'</p>';
    										$output .= '<p><a href="'.  get_permalink() .'" class="small button radius secondary"><i class="icon-angle-right"></i> '.__("READ MORE", 'kleo_framework').'</a></p>';
    										$output .= '</div>';
    								}
    
    								break;
    
    						case 'gallery':
    								$slides = get_cfield('slider');
    								if (!empty($slides)) 
    								{
    										$output .= '<div class="four columns">';
    										$output .= '<div class="blog-slider">';
    
    										foreach($slides as $slide) 
    										{
    											if (get_attachment_id_from_url($slide))
    											{
    												$thumb_array = image_downsize( get_attachment_id_from_url($slide), 'blog_carousel' );
    												$thumb_path = $thumb_array[0];
    											}
    											else
    											{
    												$thumb_path = $slide;
    											}
    
    											$output .= '<div data-thumb="'.$slide.'">';
    											$output .= '<img src="'.$thumb_path.'" alt="">';
    											$output .= '</div>';
    										}
    										$output .= '</div><!--end blog-slider-->';
    
    										$output .= '<h4>'.get_the_title().'</h4>';
    										$output .= '<p>'.  word_trim(get_the_excerpt(), 15, '...').'</p>';
    										$output .= '<p><a href="'.  get_permalink() .'" class="small button radius secondary"><i class="icon-angle-right"></i> '.__("READ MORE", 'kleo_framework').'</a></p>';
    										$output .= '</div>';
    								}
    
    								break;
    
    						case 'image':
    								if (get_post_thumbnail_id())
    								{   
    										$output .= '<div class="four columns">';
    										$output .= '<div class=""><a class="imagelink" href="'.  get_permalink().'">';
    										$output .= get_the_post_thumbnail(null,'blog_carousel');
    										$output .= '</a></div>';
    
    										$output .= '<h4>'.get_the_title().'</h4>';
    										$output .= '<p>'.  word_trim(get_the_excerpt(), 15, '...').'</p>';
    										$output .= '<p><a href="'.  get_permalink() .'" class="small button radius secondary"><i class="icon-angle-right"></i> '.__("READ MORE", 'kleo_framework').'</a></p>';
    										$output .= '</div>';
    
    								}
    								break;
    						default:
    										$output .= '<div class="four columns">';  
    										if (get_post_thumbnail_id())
    										{  
    												$output .= '<div class=""><a class="imagelink" href="'.  get_permalink().'">';
    												$output .= get_the_post_thumbnail(null,'blog_carousel');
    												$output .= '</a></div>';
    										}
    										$output .= '<h4>'.get_the_title().'</h4>';
    										$output .= '<p>'.  word_trim(get_the_excerpt(), 15, '...').'</p>';
    										$output .= '<p><a href="'.  get_permalink() .'" class="small button radius secondary"><i class="icon-angle-right"></i> '.__("READ MORE", 'kleo_framework').'</a></p>';
    										$output .= '</div>';
    								break;
    				}
    
    		endwhile;
    		wp_reset_postdata();
    		$output .= '</div>';
    
    		return $output;
    }
    add_shortcode('kleo_my_posts', 'kleo_my_posts');
    
    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

Viewing 4 posts - 1 through 4 (of 4 total)

The forum ‘Sweetdate – WordPress’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?