Template post – shorcode plugin

Home Forums All Other Themes Template post – shorcode plugin

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #114203
    VatanVatan
    Participant
    • Topics: 2
    • Replies: 5
    • Total: 7
    Member since: December 29, 2018

    Ahoj, mám problém. Snažím sa spraviť šablónu pre kategórie článkov. Skúsil som použiť plugin SHORCODES pre kategóriu článkov.
    [su_posts template="templates/default-loop.php" id="" posts_per_page="10" post_type="post" taxonomy="category" tax_term="MATERIALY" tax_operator="IN" author="" meta_key="" offset="0" order="DESC" orderby="name" post_parent="" post_status="publish" ignore_sticky_posts="no"]

    It works but I do not like the design of my articles. I would like to be the ORIGINAL latestnews shortcode design in Decor theme.

    can you tell me how to look the file templates/default-loop.php ???
    Original code `<div class=”su-posts su-posts-default-loop”>

    <?php if ( $posts->have_posts() ) : ?>

    <?php while ( $posts->have_posts() ) : $posts->the_post(); ?>

    <div id=”su-post-<?php the_ID(); ?>” class=”su-post”>

    <?php if ( has_post_thumbnail( get_the_ID() ) ) : ?>
    <a class=”su-post-thumbnail” href=”<?php the_permalink(); ?>”><?php the_post_thumbnail(); ?></a>
    <?php endif; ?>

    <h2 class=”su-post-title”><a href=”<?php the_permalink(); ?>”><?php the_title(); ?></a></h2>

    <div class=”su-post-excerpt”>
    <?php the_excerpt(); ?>
    </div>

    </div>

    <?php endwhile; ?>

    <?php else : ?>
    <h4><?php _e( ‘Posts not found’, ‘shortcodes-ultimate’ ); ?></h4>
    <?php endif; ?>

    </div>
    `

    My “work” to achieve design:

    <?php
    
        function latestpostsoutput_func( $atts ){
       extract( shortcode_atts( array(
    		'templat' => '',
    		'excerpt_length' => '',
    		'readmore' => '',
            'template' => 'templates/default-loop.php',
            'id' => '',
            'posts_per_page' => '',
            'post_type' => '',
            'taxonomy' => '',
            'tax_term' => '',
            'tax_operator' => '',
            'autor' => '',
            'meta_key' => '',
            'offset' => '',
            'order' => '',
            'orderby' => '',
            'post_parent' => '',
            'post_status' => '',
            'ignore_sticky_post' => '',
           
    	), $atts ) );
    	$postoutput = '';
    	wp_reset_query();
    	$n = 0;
    	query_posts(  array( 'posts_per_page'=>$show, 'post__not_in' => get_option('sticky_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">
    									<a href="'.get_permalink().'"><h3>'.get_the_title().'</h3></a>
    
    				     '.wp_trim_words( get_the_content(), $excerpt_length, '...' ).'
    ; 
    				   <a href="'.get_permalink().'" class="news-link">'.$readmore.'</a>
    			    </div>
    			</div>';
     						$postoutput .= ''.(($n%2==0) ? '<div class="clear"></div>' : '');	
    		endwhile;
    
    	wp_reset_query();
    	return $postoutput;
          }     
          
     add_shortcode( 'latestposts', 'latestpostsoutput_func' );     
          
              ?>
    

    Please help, I’m going to categorize
    The original shortcode does not work
    [latestposts show="2" excerpt_length="20" cat="" readmore="READ MORE"]

    I mean the division of cat = “”

    Thank you for your answer and help

    #114224
    Sonl SinhaSonl Sinha
    Moderator
    • Topics: 0
    • Replies: 31035
    • Total: 31035
    Member since: August 16, 2013

    Hi,

    Kindly show us your website URL?

    Regards,
    Brad

    #114229
    VatanVatan
    Participant
    • Topics: 2
    • Replies: 5
    • Total: 7
    Member since: December 29, 2018

    Hello, url my website Category materials and Materials test

    #114839
    VatanVatan
    Participant
    • Topics: 2
    • Replies: 5
    • Total: 7
    Member since: December 29, 2018

    hello so will someone help me split articles on categories with visuals from Decor theme ???!

    #114854
    Sonl SinhaSonl Sinha
    Moderator
    • Topics: 0
    • Replies: 31035
    • Total: 31035
    Member since: August 16, 2013

    Hi,

    Kindly send us your URL of the site and WordPress admin details (Username & Password) via email: [email protected] Please mention this forum URL while replying so that we understand what needs to be done.

    Regards,
    Brad

    #114855
    VatanVatan
    Participant
    • Topics: 2
    • Replies: 5
    • Total: 7
    Member since: December 29, 2018

    data sent. I need to list the articles according to the category of designs as provided on the homepage Decor theme

    #114887
    Sonl SinhaSonl Sinha
    Moderator
    • Topics: 0
    • Replies: 31035
    • Total: 31035
    Member since: August 16, 2013

    Hi,

    Added category option in the shortcode: [latestposts show=”2″ excerpt_length=”20″ category=”materialy” readmore=”READ MORE”]

    Kindly use category slug in it, here is the working example: https://www.stolarstvoidunk.eu/test/

    Regards,
    Brad

    #114940
    VatanVatan
    Participant
    • Topics: 2
    • Replies: 5
    • Total: 7
    Member since: December 29, 2018

    Thank you very much 🙂

    #114976
    Sonl SinhaSonl Sinha
    Moderator
    • Topics: 0
    • Replies: 31035
    • Total: 31035
    Member since: August 16, 2013

    Hi patrik,

    If you found our service good kindly review us here: https://www.sktthemes.org/forums/topic/reviews-and-testimonials/page/20/

    Regards,
    Brad

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.