Connect with us

Tips & Tricks

How to: Display RSS feeds from anywhere

Published

on

Here is a simple way to display any RSS feed in your WordPress blog.

<?php include_once(ABSPATH . WPINC . '/rss.php');
	$rss = fetch_rss('http://feeds2.feedburner.com/WPCult');
	$items = array_slice($rss->items, 0, 4);

		if (empty($items)) echo '<li>No items</li>';
		else
			foreach ( $items as $item ) : ?>
            <a style="font-size: 14px;" href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'><?php echo $item['title']; ?></a><br /> 
            <p style="font-size: 10px; color: #aaa;"><?php echo date('F, j Y',strtotime($item['pubdate'])); ?></p>
            <p><?php echo substr($item['summary'],0,strpos($item['summary'], "This is a post from")); ?></p>
            <?php endforeach; ?>

The first step is to include the WordPress file rss.php then will apply code after to style the feeds.

Of coarse I forgot to mention, change the RSS feed to the feed you want to pull.

Tips & Tricks

Echo custom fields in any category

Published

on

Here is a neat trick. Say you want to show a custom field in you post or in a certain categories post. There is a simple code you need to write in order to accomplish this:

<?php $image = get_post_meta($post->ID, "image", $single = true); ?>
<?php if($image != '') : if(in_category(7)) { echo ''; } else { ?>
<img src="<?php echo $image ?>" alt="<?php the_title(); ?>" /></a>

In the example above I am calling the variable $image and telling the server that it equals the value of “image” inside get_post_meta or “custom field” of the current post.

Then we are asking if that variable $image doesn’t equal nothing or != and if it is in the category id of 7, echo what ever is in the single quotes (which is nothing in this example), otherwise show the <img> and the value inside “image” which should be the location of the image.

Update: Thanks to Austin from PressedWords for pointing out his trick, from the comment below.

Continue Reading

Tips & Tricks

Disable caching of your site or post

Published

on

I talked about Disabling search engine on search pages in a previous post using the meta tag. Today lets go over the web bots Cached copy of your site. If you are working on builder your blog, or have a temporary site up, use the following code:

<meta name="robots" content="noarchive">

This will tell any bot to follow your site, index it, but prevents a cached copy of this page from being available in the search results.

Continue Reading

Tips & Tricks

Disable search engine on search pages

Published

on

A good idea when trying to get the most out of your blog is usging the meta tag to tell the web bots to search & index your site. But for good SEO you should apply this code in your header.php file of your WordPress blog.

<?php if(is_search()) { ?>
<meta name="robots" content="noindex, nofollow" />
<?php }?>

This will keep your site from getting a hit from bots over duplicate entries. 🙂

Continue Reading

Random Search Terms

Title

Top Articles

Top Searches

powered by WassUp

Recent Posts: Fully Net Worth . com

Jade Cline Net Worth: How Rich is the Teen Mom star Actually?

Jade Cline Net Worth: How Rich is the Teen Mom star Actually?

Jade Cline is a TV personality who is best known for being a part of different MTV shows including “Teen Mom” and the “Young and Pregnant”. She replaced Jenelle Evans in the second half of Season 9 of Teen Mom 2. As of 2019, Jade Cline net worth is estimated to be $150,000. Jade was […]

Jimmy Hoffa Net Worth: How Rich was Jimmy Hoffa Actually?

Jimmy Hoffa Net Worth: How Rich was Jimmy Hoffa Actually?

Jimmy Hoffa was an American labor union leader. He served as the President of the International Brotherhood of Teamsters union from 1957 to 1971. Jimmy Hoffa net worth at the time of his death is estimated to be $13 million. Hoffa was born on February 14, 1913, in Brazil, Indiana to John and Viola Hoffa. […]

David Grutman Net Worth: How Rich is Dave Grutman Actually?

David Grutman Net Worth: How Rich is Dave Grutman Actually?

David or Dave Grutman is an American entrepreneur who is the owner and partner in several Miami-based restaurants and night clubs. As of 2019, David Grutman net worth is estimated to be $150 million. David was born on July 3, 1974, in Naples, Florida and was raised in a Jewish family. He holds a degree […]

Trending

%d bloggers like this: