I'm a php retard...how would I make this happen.

efeezy

New member
Oct 5, 2007
5,250
136
0
50
Here's what I'm trying to accomplish. I want to add a "related products" section to the bottom of my single posts on a wordpress blog.

Here's how I want it to work, I just dont know how to code it.

Create a relatedproducts.php file (this file will have the html code for the ads I want shown so I can tweak them when necessary)

I know I need a php call on the single.php file in order to get the ads pulled over to that location. This can't be too complicated, but I'm not getting how to make it work. Thanks for the help. I really need to breakdown and buy a PHP for dipshits book.
 


<?php
include("relatedproducts.php");
?>

That command will just pull in the php file relatedproducts.php. Is this what you were looking for?
 
can't think of the name of the plugin -- generic footer or something like that. It takes what you enter in and puts at the bottom of every post.

Nothing fancy needed. Don't need to create a page, etc...

OR create your 'whatever.php' page and open up singlepost template page and edit directly to include whatever.php (see above post for code).

OR install execphp plugin and you can "include" files in your posts.

Sounds like generic footer would do the trick for you though.
 
<?php
include("relatedproducts.php");
?>

That command will just pull in the php file relatedproducts.php. Is this what you were looking for?

Crap..I tried that, I thought, but it wasn't pulling. I'll try it again and see if I had it formed incorrectly.
 
No it works now. Exactly like I wanted. I must have forgotten a semicolon or something, because it works perfectly. Thanks. +rep
 
can't think of the name of the plugin -- generic footer or something like that. It takes what you enter in and puts at the bottom of every post.

Nothing fancy needed. Don't need to create a page, etc...

OR create your 'whatever.php' page and open up singlepost template page and edit directly to include whatever.php (see above post for code).

OR install execphp plugin and you can "include" files in your posts.

Sounds like generic footer would do the trick for you though.

This one? WordPress › Header-Footer WordPress Plugins

No idea if it plays nicely with exec-php but can't see why not. It would prob be easier just to add an include into the template though.