webbmary
Forumsvar skapade
Visar 1 svar (av 1 totalt)
-
Forum: Allmänna frågor
Som svar på: Hämta utvald bild från portfolio// Arguments $args = array( 'post_type' => 'portfolio', 'posts_per_page' => 6, ); // The Query $the_query = new WP_Query( $args ); // The Loop if ( $the_query->have_posts() ) { echo "<div class='images-grid'>"; while ( $the_query->have_posts() ) { $the_query->the_post(); $featuredimage = get_the_post_thumbnail_url (get_the_ID(), 'full'); echo "<div>"; echo '<a href="'; echo get_permalink(); echo '">'; echo "<div class='case-image' style='background-image: url(".$featuredimage.")'>"; echo "<div class='case-row-top '>"; echo "<h4>".get_the_title()."</h4>"; echo "<h2>".get_field('underrubrik')."</h2>"; echo "</div>"; echo "<div class='case-row-bottom'>"; echo "<img src='https://develop.creative.exaktahosting.se/wp-content/uploads/2022/08/arrow-right-white.svg'>"; echo "</div>"; echo "</div>"; echo '</a>'; echo "</div>"; } echo "</div>"; echo '<div class="case-image-toggle"><a href="#" class="toggle-expand-grid"></a></div>'; /* Restore original Post Data */ wp_reset_postdata(); }Löste det såhär
Visar 1 svar (av 1 totalt)