Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. <?php
  2. function get_spec_posts_func( $atts ){
  3. $query = new WP_Query( array( 'category_name' => $the_category ) );
  4. if ( $query->have_posts() ) {
  5. echo "<h1>Our projects</h1>";
  6. echo '<div class="grid-x">';
  7. while ( $query->have_posts() ) {
  8. $query->the_post();
  9. $imgurl = get_the_post_thumbnail_url($post ,'medium_large'); ?>
  10.  
  11. <div class="cell small-12 medium-12 large-4 projektrad" style="background-image:url(<?php echo $imgurl;?>); background-size:cover;">
  12. <h3 class="projekttitel"><a href="<?php echo get_the_permalink(); ?>"> <?php echo get_the_title() . '</a></h3>' . '</div>';
  13.  
  14. }
  15. echo '</div>';
  16. /* Restore original Post Data */
  17. wp_reset_postdata();
  18. } else {
  19. // no posts found
  20. }
  21. }
  22. add_shortcode( 'get_my_posts', 'get_spec_posts_func' );
  23. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement