Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   RSS, Feeds & Subscribing (http://forum.bytesforall.com/forumdisplay.php?f=18)
-   -   Javascript, Adsense, RSS, and Comments (http://forum.bytesforall.com/showthread.php?t=951)

Jerry Mar 25, 2009 10:18 AM

Javascript, Adsense, RSS, and Comments
 
Hi Flynn,
It's been awhile, I hope you and yours are doing well!
I want to make some changes to my site http://enaturesremedies.com/
I figured I'd ask in one place, hope that works ok.
1. I would like to offer Amazon books at the bottom of each page (I'm using a new page-page for each new post.) I want to put a piece of javascript in so that when you hover over the image of the book you see a little window with more info. I can put it after the Adsense code you showed me here.
2.I want to inbed another Adsense block into my articles in addition to the Adsense block I inbedded in the link above (at the start of each article.) I think I can follow those instructions and get it done?
3.I have the email up-dates working with my Feedburner account, but since I'm creating a new page for each article the post feed won't work? I want to offer a feed for each new page.
4.I want to put info that will appear on each new page instructing people on the comment policy.
5.I also want to take away the ability of commenters to link out with their name or within the comment itself, on page-pages.I would like to leave that ability intact on the "home" page though.
I know I'm asking a lot here, and I hope it proves to not be too difficult:)
I of course am headed to the donate page right now!
Thanks for all your help Flynn

Flynn Mar 25, 2009 11:45 AM

1. & 2. Put this at the bottom of functions.php (instead of the other, similar code you have there now)

PHP Code:

<?php        
function bfa_add_adsense($post_body_content) {
$adsense_ad '
<div class="bfa-adsense">
WHOLE
ADSENSE
AD
HERE
</div>
'
;
$adsense_ad_2 '
<div class="bfa-adsense-2">
WHOLE
ADSENSE #2
AD
HERE
</div>
'
;
$amazon_ad '
<div class="bfa-amazon">
WHOLE
AMAZON
AD
HERE
</div>
'
;

if ( 
is_single() OR is_page() ) {
if (
strpos($post_body_content,'%adsense%')!==FALSE) {
// Replace %adsense% with content of $adsense_ad_2
$post_body_content str_replace('%adsense%'$adsense_ad_2$post_body_content);
}
// Add $adsense_ad at top and $amazon-ad at bottom
$post_body_content $adsense_ad $post_body_content $amazon_ad;
return 
$post_body_content;
}
add_filter('the_content''bfa_add_adsense');
?>



CSS Insert (example)

HTML Code:

div.bfa-adsense {
float: left;
display: block;
margin: 1em 10px 5px 0; /* margin 1em top, 10px right, 5px bottom, 0 left */
}
div.bfa-adsense-2 {
float: right;
display: block;
margin: 10px;
}
div.bfa-amazon {
display: block;
margin: 1em;
}

3. This plugin seems to enable Feeds for "Page" pages http://www.devtrench.com/quick-and-d...e-feed-plugin/

4. In index.php put

PHP Code:

<?php if ( is_page() ) {?>
Text or HTML to appear on all pages
<?php ?>

wherever you want the text to appear, i.e. right before

PHP Code:

<?php // Load Comments template (on single post pages, and "Page" pages, if set on options page)


Jerry Mar 25, 2009 12:03 PM

Thanks Flynn,:)
I really appreciate the quick and thorough reply!

Flynn Mar 25, 2009 12:16 PM

5. What do you want to do with the links. Should the link URL be displayed?

<a href="http://www.commenters-site.com/" rel="nofollow">this site</a>

becomes, i.e.

this site [URL: http://www.commenters-site.com/]

or

this site

or

http://www.commenters-site.com/ (not linked)


All times are GMT -6. The time now is 07:48 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.