Thanks juggledad. I knew it was something pretty obvious but I am bad at coding.
I guess I'll see if everything works and report back, my blog is just underway and has post scheduled every day for the next week or so but I only have one post up so far, so I'll be able to tell in a few days. |
errr I have a problem already. I moved the script outside the post div and it is still in the same spot which is good, but when I put the php code around it, I had some issues.
When I clicked on the post title, it took me to a totally blank page. Same when I clicked on the categories. When I removed the php from the code everything worked fine again. Not really sure about this... |
Quote:
I feel like the blank page error might have arisen because there is only one post on single post pages? If it is possible to get the ad to appear on single post pages as well, I would like to know how to do that. If there is a fix to get the ad to appear below the first TWO posts without getting the blank page error, that would be great too but I can live with it being below just the first post. |
Try this
HTML Code:
<?php if ( is_single() or (is_page() AND $postcount =< 2) ) { ?> |
I kept getting blank pages when I used "=<" but I got this to work:
PHP Code:
|
Quote:
|
Which errors?
|
Man I forget exactly, but it was something like a white page with just a line of text at the top that said "Unexpected "=" found at line 587". I could reproduce the error if you would like specifics.
|
I get this error too.. the exact error is:
Parse error: syntax error, unexpected '=' in /var/www/MY SERVER PATH HERE/blog/wp-content/themes/atahualpa/functions.php on line 532 |
Make sure you aren't closing the single quotes that wrap the adsense code, pre-maturely:
adsense_ad = '<div class="bfa-adsense"> PUT YOUR WHOLE ADSENSE CODE HERE </div>'; If you have single quotes inside your code, you'll need to escape them by putting a backslash in front of them. You don't need to escape double quotes:adsense_ad = '<div class="bfa-adsense"> PUT YOUR \'WHOLE\' ADSENSE "CODE" HERE </div>'; or wrap your code into double quotes instead of single quotes. In that case you need to escape double quotes, if you have any: adsense_ad = "<div class="bfa-adsense"> PUT YOUR 'WHOLE' ADSENSE \"CODE\" HERE </div>"; |
If anyone out there is interested, I ended up using a Plugin called "Advertising Manager" to get the ad in the content. It's pretty simple to use.
One more question tho...I am editing the center column and if I want something to show up on multi post pages, EXCLUDING the homepage/frontpage, how would I go about that? |
hi Flynn,
Don't mean to hijack this thread but, I can't seem to find the code in the forum on how to add the adsense code on the sidebar. I have been browsing through the forum and I can't seem to find the exact way to insert adsense code on the sidebar. Any help would appreciated. thanks a lot! Em http://techsupporthelp.web44.net |
finaldata,
I use a plugin called "Advanced Text Widget". I don't even think you need that, but just insert the script google gives you into a text box on your sidebar. You have to drag the text box over on the "widgets" page and then put the code in there and hit save. |
I obviously did something very wrong.
I entered the code as you posted, but I thought I was supposed to enter it outside the php ?> Now I get this: Parse error: syntax error, unexpected '=' in /home/collette/public_html/MYSITE.com/wp-content/themes/atahualpa342/functions.php on line 553 I'm locked here. I can't get into my WP dashboard to undo the change. HELP!!! |
So I edited the file in cPanel, and that "seemed" to fix the problem.
But now, when I go into WP admin, I get this at the top of every screen: Warning: Cannot modify header information - headers already sent by (output started at /home/collette/public_html/MYSITE.com/wp-content/themes/atahualpa342/functions.php:553) in /home/collette/public_html/MYSITE.com/wp-includes/functions.php on line 784 Warning: Cannot modify header information - headers already sent by (output started at /home/collette/public_html/MYSITE.com/wp-content/themes/atahualpa342/functions.php:553) in /home/collette/public_html/MYSITE.com/wp-includes/functions.php on line 785 Does anybody have ANY idea what's going on here? I didn't touch the header! Added: and when I try to reset the page options using the admin panel, I get a blank page with the same two messages. Update: Deleted and re-uploaded the whole thing. Still have no idea what happened. |
Header already sent usually means that there is a blank line at the bottom of functions.php
|
this plugin solves all the adsense problems - it's great:
Whydowork Adsense If you're working with wordpress, you can just upload it. Otherwise, just google for it. I can put adsense just about anywhere I want. |
Hi,
(My first post - I'm a new blogger with some programming experience. I love the theme and the active support on the forum.) I have the same problem as adum #33 and river #34 above - when I make the addition to functions.php things get messed up: Parse error: syntax error, unexpected '=' in /home/MYUSERNAME/public_html/MYBLOG/wp-content/themes/atahualpa/functions.php on line 533 Here's a part of my functions.php with line numbers added: PHP Code:
PHP Code:
However, if I skip the assignment it won't result in an error: PHP Code:
I guess this is why I never will be a great programmer, there is nothing that makes me as frustrated as this. |
try this
HTML Code:
533 $adsense_ad = '<div class="bfa-adsense"> |
I am also experiencing the problem with "parse error" when I try to modify functions.php. I have just upgraded to Atahualpa 3.4.1. When I put in the code (exactly as shown without any spaces, etc., or modifications to anything else), it breaks my blog. I couldn't even get into wp-admin to fix anything. Thank goodness I backed up my complete folder that holds my blog via FTP. I tried another suggestion to delete the Atahualpa folder from themes (which it was said should default back to default template), but my blog was still not showing. The only thing that worked was to re-upload via FTP my saved blog folder and overwrite the contents. I am not asking for any help with this, I just wanted to add in that I have experienced the same problem. The really frustrating thing is that I copied and pasted the contents of functions.php into a notepad, in case the added code caused a problem, so I that I could copy/paste back in EXACTLY what was there originally and it didn't help. I even went to another blog I have that uses atahualpa and copied out the functions.php but no dice. The only thing that worked in the end was to re-upload my saved blog folder. I've already deleted and re-uploaded twice today, guess I'll be waiting on getting Adsense to the byline area of my single posts.
|
BTW, I decided to try the Whydowork Adsense plug-in. I have it working now, it was very easy to install. Just be sure you click on "show adsense to administrator" while working on it, or you won't be able to see if it's working!!
|
Quote:
PHP Code:
PHP Code:
I put some extra conditions, to only put these ads in the content if the post is over a month old. I did that with this: Replace PHP Code:
PHP Code:
|
Hi all!
I'm new to this theme and this is my first post in thes forum. I'm trying to add Adsense to the home page of my blog. I don't like to use a plugin for Adsense, and I've added the code to functions.php plus that little piece of code in CSS inserts, and that's working great for posts. I've tried some of the suggestions here, but can't get anything to work. I did get Adsense to show up on pages, which I don't want. I just want it to be on single posts and the home page. Any advice is greatly appreciated! :) |
This post was originally opened when Atahualpa waas at version 3.2 - it's now at version 3.4.6 with some major changes. One of them is the option 'The LOOP' in the 'Style & edit CENTER COLUMN' area.
you can do all sorts of things here and pretty muck eliminate most of the changes to the code (like function.php) and save yourself having to make those changes again at the next release. By putting in some simple php logic in the 'Content ABOVE the LOOP' you could have your AD show up at the top of the center area before the posts HTML Code:
<?php if (is_single() or is_front_page()) { ?> <div class="bfa-adsense"> |
NOTE: if you got the error
HTML Code:
Parse error: syntax error, unexpected '=' in /home/djembata/public_html/formula1/wp-content/themes/atahualpa/functions.php on line 669 HTML Code:
adsense_ad = '<div class="bfa-adsense"> HTML Code:
$adsense_ad = '<div class="bfa-adsense"> |
All times are GMT -6. The time now is 10:40 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.