• Can you help me figure out what’s wrong with this coding????

    // Add Shortcode
    function book_display_shortcode( $atts ) {
    	extract( shortcode_atts(
    		array(
    			'author' => 'default',
    			'type' => 'products',
    		), $atts ) );
    
    $args = array (
    	'post_type' => $type,
    	'tag_name' => $author,
    	);
    $book_query = new WP_Query( $args );
    ob_start();
    ?>
    <div class="books-display">
    <?php if ( $book_query->have_posts() ) {
    	while ( $book_query->have_posts() ) {
    		$book_query->the_post();
    
    		<a> " > <?phpget_the_post_thumbnail($post_id, 'thumbnail'); ?> </a>
    
    		}
    		} else {  // no posts found 
    
    		}
    		wp_reset_postdata(); ?>
    		</div>
    		<?php return_ob_get_clean(); 
    
    }
    add_shortcode( 'books', 'book_display_shortcode' );
Viewing 1 replies (of 1 total)
  • This line:

    <a> " > <?phpget_the_post_thumbnail($post_id, 'thumbnail'); ?> </a>

    is coded incorrectly. Not sure what you were trying to do, so cannot suggest a correction. The quote and following ‘>’ are definitely not correct. Also, you are missing a space in ‘<?phpget_the_ …’.

Viewing 1 replies (of 1 total)
  • The topic ‘Shortcode Coding not working’ is closed to new replies.