ACF Password Protected Loop

<?php // Custom Loop add_action('genesis_before_content_sidebar_wrap', 'maru_cpt_loop'); function maru_cpt_loop() { if ( ! post_password_required() ) { ?> <?php // Display Recursos $args = array ( 'post_type' => 'recursos', 'posts_per_page' => '-1', 'orderby' => 'menu_order', 'order' => 'desc' ); $loop = new WP_Query( $args ); if( $loop->have_posts() ) { ?> <div class="content"> <ul class="flex space top"> <?php while ( $loop->have_posts() ) { $loop->the_post(); ?> <article class="one-third post"> <div class="grid-foto"><?php echo the_post_thumbnail('grid-thumbnail'); ?></div> <div class="entry-content"> <h2 class="entry-title"><?php echo wp_trim_words( get_the_title(), 4, '...' ); ?></h2> <?php if( get_field('download') ) { ?> <a class="button" href="<?php echo get_field( 'download' ); ?>">DESCARGAR</a> <img src="<?php echo get_field( 'foto_der' ); ?>"/> <?php } ?> </div> </article> <?php } ?> </ul> </div> <?php } wp_reset_postdata(); } the_content(); }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.