50 )
$items = 2;
$flickr = get_option( 'flickr' );
if ( empty( $flickr ) ){
$flickr = "http://api.flickr.com/services/feeds/photos_public.gne?id=90827185@N00&lang=en-us&format=rss_200";
}
$rss = fetch_rss( $flickr );
if( is_array( $rss->items ) ) {
//$out = '';
$out = wp_cache_get('hopeii');
if ( false == $out ) {
$items = array_slice( $rss->items, 0, $items );
while( list( $key, $photo ) = each( $items ) ) {
preg_match_all("/0)
$out .= ",\n";
$out .= '["' . $photo_url . '", "' . $photo['link'] . '", "_new", "'. wp_specialchars( $photo[ 'title' ], true ). '"]';
}
wp_cache_set('hopeii', $out, 'theme', 21600); //cache for 6 hours
} //end cache
}
?>
false);
$file = wp_handle_upload($_FILES['import'], $overrides);
if ( isset($file['error']) )
wp_die( $file['error'] );
$url = $file['url'];
$type = $file['type'];
$file = $file['file'];
$filename = basename($file);
$object = array(
'post_title' => $filename,
'post_content' => $url,
'post_mime_type' => $type,
'guid' => $url
);
$id = wp_insert_attachment($object, $file);
wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
update_option('background_image', esc_url($url));
}
if ( $_POST['update'] ) {
if ( isset($_POST['twit']) ) {
$twit = strip_tags(stripslashes($_POST["twit"]));
update_option( 'twit', $twit );
}
if ( isset($_POST['flickr']) ) {
$flickr = strip_tags(stripslashes($_POST["flickr"]));
$items = strip_tags(stripslashes($_POST["rssnum"]));
update_option( 'flickr', $flickr );
update_option( 'rssnum', $items );
} else {
delete_option( 'flickr' );
delete_option( 'rssnum' );
}
echo 'Options saved successfully.
';
}
if ( esc_attr( $_POST[ 'action' ] ) == 'reset' ) {
check_admin_referer('custom-background');
delete_option('background_image');
echo 'The background has reset successfully.
';
}
?>
Support Rehtse Evoli Theme
I am happy that you get a coffee to me, Thanks! Patrick
Get theme support at Facebook
You may look me at my penote
".__('Tips: You may custom your blog theme header and gallery with your flickr.') ."
". sprintf(__('You must enter the flickr/PicasWeb feed url for it to work.'), "themes.php?page=theme-setting")."
";
}
add_action('admin_notices', 'hope_tips');
}
add_action( 'admin_menu', 'hope_admin_menu' );
add_action( 'wp_footer', 'hope_flickr' );
?>