![]() |
![]() |
![]() |
||||
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. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
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; ?> |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
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.
|
![]() |
![]() ![]() ![]() ![]() ![]() |