instead of returning the value the_ID function print the value on screen.
So here is one small hack to get it done.
<?php include_once(ABSPATH . WPINC . ‘/rss.php’);
ob_start();
the_ID();
$ID=ob_get_clean();
wp_rss(“http://search.twitter.com/search.atom?q=MR_$ID)”, 10); ?>
Enjoy… In India we call it a Jugaad
What about using custom fields? I have a custom field called rss which stores the url to the rss feed for a site. I’d like to grab the value and place it into the wp_rss call.
wp_rss("http://search.twitter.com/search.atom?q=MR_{$post->ID})", 10); ?>
If you’re in a function, you’ll need to call global $post; before that.
btw get_the_ID() function is also there.
Hello
Im having an issue with calling a custom field data into the feed url.
I basically want a page to show a different feed url based on whats been inputed into the custom field option. How would i implement this using this setup.
<?php
$feeds = get_post_meta($post->ID, 'feeds',true);
?>
<?php
include_once(ABSPATH.WPINC.'/rss.php'); // path to include script
$feed = fetch_rss('FEED-URL I WANT TO CALL FROM A CUSTOM FIELD'); // specify feed url
$items = array_slice($feed->items, 0, 3); // specify first item and duration
?>
<?php if (!empty($items)) : ?>
<?php foreach ($items as $item) : ?>
<a href="<?php echo $item['link']; ?>"><?php echo $item['description']; ?></a>
<?php endforeach; ?>
<?php endif; ?>
thanks in advanced to anyone with a solution.
ISSUE RESOLVED!!!
I used $feeds as my custom field option
<?php // Get RSS Feed(s)
include_once(ABSPATH . WPINC . '/rss.php');
$feeds = get_post_meta($post->ID, 'feeds',true);
$rss = fetch_rss($feeds);
$maxitems = 5;
$items = array_slice($rss->items,0,$maxitems);
?>
<ul>
<?php if (empty($items)) echo '<li>No items</li>';
else
foreach ( $items as $item ) : ?>
<li><a href='<?php echo $item['link']; ?>'
title='<?php echo $item['title']; ?>'>
<?php echo $item['title']; ?>
</a></li>
<?php endforeach; ?>
</ul>
</div>
check out the link
link