I created a widget to display ads related to the posts on my deals blog. The purpose of this widget is to display my affiliate links on all the blogs sidebar
function kish_get_deals() {
global $blog_id;
$current_blog=$blog_id;
$dealblogid=8;
switch_to_blog($dealblogid);
global $post;
$myposts = get_posts('numberposts=5&orderby=rand');
?>
<h4 class="widget">Deals - Check it out</h4>
<div style="margin: 5px;background: none transparent scroll repeat 0% 0%;padding: 5px">
<?php
foreach($myposts as $post) :
setup_postdata($post);
?>
<div style="margin-top: 3px">
<li><a href="<?php editable_post_meta($post->ID, " target="_blank">"><?php editable_post_meta($post->ID, "dtitle"); ?></a>
<?php editable_post_meta($post->ID, "ddesc"); ?>
<?php editable_post_meta($post->ID, "durl"); ?><a title="Permanent Link to <?php the_title(); ?>" rel="bookmark" href="<?php the_permalink() ?>"> ¶</a>
</li>
</div>
<?php endforeach;?></div>
<?php switch_to_blog($current_blog);
}
You need to manually add the post_meta fields (custom fields) for those particular blog posts. As I am using the front end editor, I have used the different function, you can change that to get_post_meta function instead. You can add this to your sidebar and if you are using thesis theme, add it to your custom functions.php
- Creating a Widget for Displaying Random Category Post : I just created a small hack...
- Twitter Plugin for WordPress Updated : I just have updated the new...
- Thesis Theme Works With WordPress MU : I recently got thesis theme for...
- Pagerank Checking Plugin for WordPress : I have written a simple wordpress...
- Delete WordPress Post From Frontend : If you are logged in as...
Tweet Samsung Galaxy Note Rom is available for download, but this is only for AT&T users (This ...
Tweet I am currently using a Samsung Galaxy Note and I was using an iPhone 4 and an iPad 2 along wit...