Home › Forums › All Other Themes › Template post – shorcode plugin
- This topic has 8 replies, 2 voices, and was last updated 5 years, 11 months ago by Sonl Sinha.
-
AuthorPosts
-
January 1, 2019 at 2:54 am #114203
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
January 2, 2019 at 5:08 am #114224Hi,
Kindly show us your website URL?
Regards,
BradJanuary 2, 2019 at 7:45 am #114229Hello, url my website Category materials and Materials test
January 14, 2019 at 10:18 am #114839hello so will someone help me split articles on categories with visuals from Decor theme ???!
January 14, 2019 at 12:41 pm #114854Hi,
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,
BradJanuary 14, 2019 at 1:04 pm #114855data sent. I need to list the articles according to the category of designs as provided on the homepage Decor theme
January 15, 2019 at 5:33 am #114887Hi,
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,
BradJanuary 15, 2019 at 5:56 pm #114940Thank you very much 🙂
January 16, 2019 at 11:26 am #114976Hi patrik,
If you found our service good kindly review us here: https://www.sktthemes.org/forums/topic/reviews-and-testimonials/page/20/
Regards,
Brad -
AuthorPosts
- You must be logged in to reply to this topic.