ali74 Posted March 31, 2012 Share Posted March 31, 2012 Hello I use wordpress , I have a php code for show rss in my site <?php include_once(ABSPATH . WPINC . '/rss.php'); $rss = fetch_rss('http://siteshoma.com/feed/'); $maxitems = 5; //Number for show $items = array_slice($rss->items, 0, $maxitems); ?> <ul> <?php if (empty($items)) echo '<li>there is no content</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; ?> this above php code work fine in my site I want 3 things in this above code 1- All of rss show be come after http://p30af.com/go.php?url= ( like http://p30af.com/go.php?url=http://google.com ) 2 - all of link open in new tab ( target="_blank") 3 - nofollow all of rss link ( rel="nofollow") how I can do this? please add this things and give me new code tanks for you best forum Quote Link to comment https://forums.phpfreaks.com/topic/260074-how-i-can-nofollow-rss-out-link/ Share on other sites More sharing options...
QuickOldCar Posted April 1, 2012 Share Posted April 1, 2012 <?php include_once(ABSPATH . WPINC . '/rss.php'); $rss = fetch_rss('http://siteshoma.com/feed/'); $maxitems = 5; //Number for show $items = array_slice($rss->items, 0, $maxitems); ?> <ul> <?php if (empty($items)) echo '<li>there is no content</li>'; else foreach ( $items as $item ) : ?> <li><a target="_blank" rel="nofollow" title="<?php echo $item['title'];?>" href="<?php echo "http://p30af.com/go.php?url=".$item['link'];?>"><?php echo $item['title'];?></a></li> <?php endforeach; ?> forgot to add your title back in Quote Link to comment https://forums.phpfreaks.com/topic/260074-how-i-can-nofollow-rss-out-link/#findComment-1333166 Share on other sites More sharing options...
ali74 Posted April 1, 2012 Author Share Posted April 1, 2012 Excellent worked for me ( you can see here http://p30af.com ) you gave me this code correctly now it is possible for you remove redirect ( go.php) form you link? Regards Quote Link to comment https://forums.phpfreaks.com/topic/260074-how-i-can-nofollow-rss-out-link/#findComment-1333355 Share on other sites More sharing options...
QuickOldCar Posted April 2, 2012 Share Posted April 2, 2012 If don't want go.php there, don't add it. If remove go.php from the url it most certainly will not find the go.php script. one thing you can do is make a folder called go, then inside make an index.php file, place the contents of go.php into there and then use a link similar to this: <li><a target="_blank" rel="nofollow" title="<?php echo $item['title'];?>" href="<?php echo "http://p30af.com/go/?url=".$item['link'];?>"><?php echo $item['title'];?></a></li> Quote Link to comment https://forums.phpfreaks.com/topic/260074-how-i-can-nofollow-rss-out-link/#findComment-1333413 Share on other sites More sharing options...
ali74 Posted April 2, 2012 Author Share Posted April 2, 2012 yes I know I do not know how I can remove correctly go.php form this code? <li><a target="_blank" rel="nofollow" title="<?php echo $item['title'];?>" href="<?php echo "http://p30af.com/go/?url=".$item['link'];?>"><?php echo $item['title'];?></a></li> Quote Link to comment https://forums.phpfreaks.com/topic/260074-how-i-can-nofollow-rss-out-link/#findComment-1333468 Share on other sites More sharing options...
QuickOldCar Posted April 2, 2012 Share Posted April 2, 2012 If this isn't what want need to explain better. <li><a target="_blank" rel="nofollow" title="<?php echo $item['title'];?>" href="<?php echo "http://p30af.com/".$item['link'];?>"><?php echo $item['title'];?></a></li> Quote Link to comment https://forums.phpfreaks.com/topic/260074-how-i-can-nofollow-rss-out-link/#findComment-1333545 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.