• guillermovargasquisoboni

    (@guillermovargasquisoboni)


    Hello (again) NoseGraze,

    I’m inserting a query of books in my front-page.php but I don’t figure out how can I get the book cover. The classic <?php the_post_thumbnail(); ?> isn’t working. I also tried with <?php get_cover_image (); ?> but it doesn’t work either. I read documentation but I cannot figure out what can I use instead of this.

    This is the entire query :

    /*************** LIST OF 3 LAST PUBLICATIONS USING NOVELIST *************/
        
    $books_query = new WP_Query( array( 'post_type' => 'book', 'posts_per_page' => 3 ) );  ?>
        
    <div id="frontpage-publications">
        <?php while ( $books_query->have_posts() ) : $books_query->the_post(); ?>
        
    <div id="publication-item">
        <header>
            <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>
        </header>
    <div id="publication-img">
            <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
            get_cover_image (); </a>
        </div>
    </div>     
        <?php endwhile; ?>
    </div>

    Best Regards,
    Guillermo

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Ashley

    (@nosegraze)

    Hiya,

    The book cover is stored as post meta. It’s not a featured image. Inside your loop, you can use this code:

    $book = new Novelist_Book( get_the_ID() );
    echo $book->get_book_cover_image();
    • This reply was modified 7 years, 9 months ago by Ashley.
    Thread Starter guillermovargasquisoboni

    (@guillermovargasquisoboni)

    I try using this piece of code inside the div “publication-img” but it doesn’t work for me :(.
    This is what I done :

    <div id="publication-item">
        <header>
            <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>
        </header>
        <div class="book-cover"><?php $book = new Novelist_Book( get_the_ID() ); echo $book->get_book_cover_image(); ?></div>
       
    </div>    

    Results is a Fatal error… Some other Clue about this issue?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How Can I get Books Cover Images on front-page.php ?’ is closed to new replies.