Issue while adding a featured image from a custom post using PHP
-
Hello,
I have created a page to display my custom posts using a query_posts. My images are displayed but I have an issue with only one image not being aligned with the others (so I blame the chunk of code related to the image). Also, if I close my img html tag, the end of the tag is displayed on the page, below the image.
Here is the code:
function wpc_shortcode( $atts ) { query_posts('posts_per_page=16&post_type=backstages&orderby=date&order=asc'); while ( have_posts() ) : the_post(); $photo = get_the_post_thumbnail(); $titre = get_the_title(); $link = get_field('link'); $size = "full"; ?> <div class="container"> <div class="row"> <div class="vc_col-sm-6 rowbackstage"> <img src="<?php echo $photo; ?>"/> <p class="titrebackstage allbackstages"><?php if( $link ): ?><a class="backstageslink" target="_blank" href="<?php echo esc_url( $link ); ?>"><?php endif; ?><?php the_title(); ?></a></p> </div> </div> </div> <?php endwhile; wp_reset_query(); // resets the aletered query back to the original echo do_shortcode('[ajax_load_more id="loadmorebtn" container_type="div" post_type="backstages" posts_per_page="6" order="ASC" orderby="date" offset="16" pause="true" button_label="Charger plus" button_loading_label="Chargement..." button_done_label="Toutes les images sont affichées" ]'); } add_shortcode( 'all_backstages', 'wpc_shortcode');
I can’t find what’s wrong in my code. Could anyone help me see clearer? I’m lost!
Thank you very much!
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Issue while adding a featured image from a custom post using PHP’ is closed to new replies.