Code fix needed for custom code Wordpress
I’m using two plugins in conjunction with a small piece of custom code on my wordpress blog.
What it is supposed to do is display in the sidebar a thumbnail with the title and first few lines of every post of the same category as the post the reader is currently reading.
So when the reader is reading a post about product A in Category 1 the code will display the title, first few lines and a thumbnail of all posts in Category 1 in the sidebar next to the article. When the reader goes to the product C in Category 3 the code shows the title, first few lines and a thumbnail of all posts in Category 3 in the sidebar and so on.
But there is an error in the code that I cant get out. This causes the code to show the first few lines of one and the same post. It gets the title right, the thumbnail to, but never the correct first few lines. Here is an example: [login to view URL]
Also, I want to limit the number of posts it shows to 10 or some other number. I want to be able to set this myself.
So the job is to 1 ) fix the code by having every title and thumbnail show with the right first few lines of the posts and 2 ) add the option of limiting the number of posts shown by the code.
Here is the code:
<div id="front-list2">
<?php global $post;
$categories = get_the_category();
foreach ($categories as $category) :
?>
<ul>
<?php
$posts = get_posts('numberposts=10&category='. $category->term_id);
foreach($posts as $post) :
?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanente link naar <?php the_title(); ?>">
<?php get_the_image('image_class=smallthumb'); ?>
</a>
<b><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></b><br />
<?php content('25'); ?>
<?php endforeach; ?>
<?php endforeach; ?>
</ul>
</div>
The two plugins I use are Executable PHP widget - to be able to use php in a widget and Get the Image in order to display a thumbnail.
Because I think it is a very simpel job for someone who knows how to code PHP for Wordpress the job pays an easy 30 dollars, paid inmidiatly after I have checked that the code supplied by you does what I want it to do.
Hi. I looked at your code, and i know what i wrong with it. Should be an easy fix to make it show the correct content. Also limiting the posts shown.
Mike
We can easily handle it in given time and cost.
* Dedicated and professional team
* Reliable working relationship
* High-quality work
* Ownership with your all files
* Delievery with on-time
* 100% satisfaction guarantee