View Single Post
  #9  
Old October 30th, 2013, 04:05 AM
raj2006 raj2006 is offline
 
Join Date: Oct 2008
Location: New Delhi, India
Posts: 147
Default

Apart from the above issue of proper display of the 3-column layout, I just need one more help.

Instead of inserting the shortcode in each blog post, I have created a php code below to automate the process. Instead of the shortcode, I have tested it with the echo statement and the php is working per se.

But, the shortcode inside the php is breaking the code. How to correct it?

Code:
<?php
$categories = get_the_category();
foreach($categories as $category) { $cat_name = $category->slug; }

switch ($cat_name)
{
	case "adult-bibs":
		[DFR:Random Product in Post?c=1222595];
		break;
	case "gloves":
		[DFR:Random Product in Post?c=1202902];
		break;
	case "kids-aprons":
		[DFR:Random Product in Post?c=1202900];
		break;		
	case "kids-bibs":
		[DFR:Random Product in Post?c=1202901];
		break;			
	case "mens-aprons":
		[DFR:Random Product in Post?c=1202899];
		break;			
	case "womens-aprons":
		[DFR:Random Product in Post?c=1202898];
		break;
}			
?>
__________________
Making Sizeable Income From Passive, Hands-Off Affiliate Marketing Is A Reality!
Learn These Guaranteed Techniques from Confessions of a Lazy Super Affiliate eBook.