danaldinho
Member
Posted 3 years ago #
Hey,
I have my blog setup as: http://www.lilwaynehq.com
Now when you leave my blog and go to a page of my website (such as http://www.lilwaynehq.com/lil-wayne, I would like to have a "Latest News" kind of widget in my sidebar, but I want it to be from my "latest-news" category from my Blog.
How would I do this?
So like, on a page of my website, in the sidebar, would be a list of 5 news articles linking to my blog. But it would automatically update as soon as I make a post on my blog.
Thanks a lot and I appreciate it :)
You could pull the Rss feed from your blog into your site using something like MagpieRSS.
danaldinho
Member
Posted 3 years ago #
Nope, there is an actually way of doing it, I've seen it done before.
Its just some php code, that will show the latest 5 posts from that "certain category" and you can place that php code on your website.
It actually might be a plugin, but I'm not sure.
So does anyone know?
Thanks a lot and appreciate it :)
danaldinho
Member
Posted 3 years ago #
drmanry
Member
Posted 3 years ago #
Something like this should get you started...
// Show the last 5 posts in the latest_news category.
<?php query_posts('category_name=latest_news&showposts=5'); ?>
<?php while (have_posts()) : the_post(); ?>
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<div class="entry">
<?php the_content(); ?>
</div>
<?php endwhile;?>
danaldinho
Member
Posted 3 years ago #
Alright mate, thanks alot, that worked fine in my blog: http://www.lilwaynehq.com :)
But is there a way for me to embed that into my website's pages which are not WordPress as that is what I mainly wanted, but this is a great start :)
Thanks.
Oh and this is the code I used:
<div class="sidebar2">
<h4 class="widgettitle">Latest Lil Wayne News</h4>
<?php query_posts('category_name=lil-wayne-news&showposts=5'); ?>
<?php while (have_posts()) : the_post(); ?>
<ul>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
</ul>
<?php endwhile;?>
</div>
danaldinho
Member
Posted 3 years ago #
Anyone got any ideas how I could use this on my un-wordpress website, but once you click on the links, it takes you to my blog :)
Thanks