I am also facing the same problem. I am having problem in including the php file to my pages.
I used the following code on a file and named it category_links.php.
Code:
<?php
$how_many=5; //How many posts do you want to show
require_once('resources/wp-config.php'); // Change this for your path to wp-config.php file ?>
<?php
$postlist = get_posts('category=13&numberposts=50');
foreach ($postlist as $post) :
?>
<p><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></p>
<?php endforeach; ?>
<?
$news=$wpdb->get_results("SELECT `ID`,`post_title` FROM $wpdb->posts
WHERE `post_type`=\"post\" AND `post_status`=\"publish\" ORDER BY post_date DESC LIMIT $how_many");
foreach($news as $np){
printf ("<li><a href=\"%s\">%s</a></li>", get_permalink($np->ID),$np->post_title);
} ?>
</ol>
when i run this file , it shows me the links to the posts in the category id 13. This shows me the result in the form of links to the posts in this particular category.
Now to include this result in my product page which belongs to the same category I added the following code on the bottom of customer/product.tpl page
Code:
<div>
{if $cat eq "274"}
<h2> Related Articles</h2>
{include file="links.tpl"}
</div>
{/if}
Here corresponding category Id is 274.
I created another file named links.tpl and tried including the php file in that, but no success.
The product page now shows header2 "Related Articles" but after that it gives me smarty error.
I feel I have reached very near to the solution, but I am certainly missing something very simple . I just need to know now, how to include my php file on my pages, so the result which it shows are available as links on my products page.
I will be very thankful for any help on this issue.
thanks