Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 03-10-2013, 03:33 PM   #1
mromro
So Fucking Banned
 
Industry Role:
Join Date: Jan 2011
Posts: 770
How to Display Specific Sponsor Ads on Posts in Wordpress

I was looking for a plugin that would display certain ads on post according to sponsors but couldn't find one.

I decided to use custom fields and edit the single post php. I'm sure this is simple for the pros out there but it drove me nuts for a while. I'm not too good at php.

this is how I did it if anyone needs it too.

add custom field called "Advertisement" with the URL to the banner location

add custom field called "Ad URL" with sponsor affiliate link

edit theme and add this code to display banner where you want on single post:

<?php if( get_post_meta($post->ID, 'Ad URL', true) && get_post_meta($post->ID, 'Advertisement', true) ) : ?>
<a href="<?php echo get_post_meta($post->ID,'Ad URL',true); ?>">
<img src="<?php echo get_post_meta($post->ID,'Advertisement',true); ?>" />
</a>
<?php endif; ?>
mromro is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-12-2013, 06:34 AM   #2
Paz
Confirmed User
 
Paz's Avatar
 
Industry Role:
Join Date: Jun 2012
Posts: 457
Nice. You could also create an author ID for each sponsor and the author ID (photo/banner, website URL etc) could be added in the single.php post with %website_URL% etc.
Paz is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.