Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function get_spec_posts_func( $atts ){
- $query = new WP_Query( array( 'category_name' => $the_category ) );
- if ( $query->have_posts() ) {
- echo "<h1>Our projects</h1>";
- echo '<div class="grid-x">';
- while ( $query->have_posts() ) {
- $query->the_post();
- $imgurl = get_the_post_thumbnail_url($post ,'medium_large'); ?>
- <div class="cell small-12 medium-12 large-4 projektrad" style="background-image:url(<?php echo $imgurl;?>); background-size:cover;">
- <h3 class="projekttitel"><a href="<?php echo get_the_permalink(); ?>"> <?php echo get_the_title() . '</a></h3>' . '</div>';
- }
- echo '</div>';
- /* Restore original Post Data */
- wp_reset_postdata();
- } else {
- // no posts found
- }
- }
- add_shortcode( 'get_my_posts', 'get_spec_posts_func' );
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement