Forums

[resolved] Display Nasa picture of the day ? (3 posts)

  1. natael
    Member
    Posted 2 years ago #

    Hi,

    Not sure how to do it best.
    I would like to display, either on a sidebar, or on a page, the Nasa picture of the day (but not on a post, I'd like it to be always visible on top of things). The latter would be automatically updated each day.
    I can't find (yet) a dedicated plugin for that. Is there a way that do not require much coding to do that ?

    The Nasa picture of the day can be seen there :
    http://www.nasa.gov/multimedia/imagegallery/iotd.html

    My blog is there (it's in french):
    http://www.lyrimages.fr

    Thanks

  2. natael
    Member
    Posted 2 years ago #

    i noticed a possibility to make a wordpress post from their site, but this is not what i'm looking for. I don't want just a link, but the actual picture.
    Just to clarify.

    Thanks

  3. Mark / t31os
    Moderator
    Posted 2 years ago #

    Grab the feed and extract the image from the feed.
    http://www.nasa.gov/rss/image_of_the_day.rss

    Assuming you can manage adding code ok, plonk this in whichever template file of your theme you want it to show up in.

    <?php
    $rss = fetch_feed( 'http://www.nasa.gov/rss/image_of_the_day.rss' );
    if( !is_wp_error( $rss ) ) {
    	$rss = $rss->get_image_url();
    	echo '<img src="' . esc_url( $rss ) . '" />';
    }
    ?>

    That should get you started... ;)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags