WordPress.org

Ready to get started?Download WordPress

Forums

get a single latest post. (2 posts)

  1. JProductions
    Member
    Posted 2 years ago #

    Is there a way to call on a single post from a specific page. I want to call on the latest video and the latest photos on my home page.

    Here is an example of what I want to do:(at the bottom)
    http://axxismotorsports.com/09/home.html

    Here is what I am working on:
    http://axxismotorsports.com/wp/

    Thanks.

  2. jkovis
    Member
    Posted 2 years ago #

    Use a WP_Query for each link.

    Something like:

    <?php
    $video_query_args = array( 'category_name' => 'videos', 'posts_per_page' => 1 );
    $video_query = new WP_Query( $video_query_args );
    
    if ( $video_query->have_posts() ) :
        while ( $video_query->have_posts() ) : $video_query->the_post();
    ?>
    <span class="homeblueTitle"><a href="<?php the_permalink(); ?>">video</a></span>
    <?php
        endwhile;
    endif;
    wp_reset_postdata();
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic