Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Atahualpa 3 Wordpress theme (http://forum.bytesforall.com/forumdisplay.php?f=2)
-   -   Ansense and other code with php conditional in byline (http://forum.bytesforall.com/showthread.php?t=14913)

mariusanhalt Jul 19, 2011 03:56 AM

Ansense and other code with php conditional in byline
 
I am trying to learn these php conditional strings/codes, espcially after the newer Atahualpa, where you can't add stuff (like adsende) via the ATO.

As for now I need adsense to be in the Byline.

So far I've come up with:

I need this adsense code:
<script>blabla adsense blabla</script>

To be in this part in index.php
<?php bfa_post_byline('<div class="post-byline">','</div>'); ?>

Reading this forum over and over lets me know that I need something called
php conditional
And after looking there I think that i might be this one:
is_single() or <?php is_single($post); ?>

But the thing is, I just cant seem to figure out where/how in
<?php bfa_post_byline('<div class="post-byline">','</div>'); ?>
I should put both the adsense-script and the php conditional, I have tried a little here and there, but I get error when trying to load the page afterwards.

Can anyone tell me how the byline string should look like with the php conditional and the adsense script correctly inserted??

And from there I hope I can experiment on my own, with other kind of scripts and places in posts, I belive they work the same way.

Thanks

juggledad Jul 19, 2011 08:13 AM

try this, change
HTML Code:

<?php bfa_post_byline('<div class="post-byline">','</div>'); ?>
to
HTML Code:

<?php bfa_post_byline('<div class="post-byline">','<script>blabla adsense blabla</script> </div>'); ?>

mariusanhalt Jul 19, 2011 11:47 AM

No.. It must be something concerning scripts, because I tried to just add text where you said, and that worked fine.

juggledad Jul 19, 2011 12:25 PM

why don't you put the script in the ato->Add Html/CSS Inserts->HTML Inserts: Header

mariusanhalt Jul 22, 2011 12:34 AM

That dident work either...
I also tried to insert the code manually in the post, and that does also not work.

It must be something "inside" the loop that are preventing it from working, because I have a Banner-ad (also adsense) that I added in the very very top of index.php before

<?php

And that works fine.
I testet the Ad on another site with Atahualpa, just an older version ( 3.5.3 ), and it works okay there..

Strange..

More strange is that I tried to install that ( 3.5.3 ) instead, on the site where I cant make the ads work, and then all text dissapered, all post and pages are there, but there is nothing in them..

SOo I changed back for the moment....

juggledad Jul 22, 2011 03:18 AM

have you tried one of the adsense plug-in's?

Not seeing the site and where and what you are putting in the code, I can't be much help since a simple typo could be causing your issues.

mariusanhalt Jul 22, 2011 03:52 AM

yep, tried plugin, it showed the spaces for the ad, but not the ad itself.

The coding in the index.php that works looks like this:

Quote:

<center><script type="text/javascript"><!--
google_ad_client = "ca-pub-7222158511372648";
/* banner lilledanmark */
google_ad_slot = "4178770608";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></center>
<p align="center"><font size="1" color="#808080">Ses bedst i 1024x768 eller
derover</font></p>


<?php
list($bfa_ata, $cols, $left_col, $left_col2, $right_col, $right_col2, $bfa_ata['h_blogtitle'], $bfa_ata['h_posttitle']) = bfa_get_options();
get_header();
extract($bfa_ata);
?>
And the one that does not work (also index.php), is surpossed to look like this, I belive:

Quote:

<?php bfa_post_headline('<div class="post-headline">','</div>'); ?>
<?php bfa_post_byline('<div class="post-byline">','<script type="text/javascript"><!--
google_ad_client = "ca-pub-7222158511372648";
/* Lilledanmark */
google_ad_slot = "6458253849";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>'); ?>
<?php bfa_post_bodycopy('<div class="post-bodycopy clearfix">','</div>'); ?>
The site is http://www.lilledanmark.dk

I can't see the typo, but I hope you are right...

juggledad Jul 22, 2011 04:07 AM

ok, here is what you do.
1) edit index.php and find line 31 which should be
HTML Code:

                <?php bfa_post_byline('<div class="post-byline">','</div>'); ?>
add the following right after it
HTML Code:

<?php if (is_single()) { bfa_widget_area('name=byline widget area'); } ?>
2) go view a single page (this will create the widget area)
3) go to the widget area in the backend - you should see 'byline widget area' in the right column
4) add a text widget to that area
5) add your script in the text widget

that's it your done. I just tested it and it works fine. You can play with the conditional to have it show where ever you want.

It's not actually in the byline, it is under it, but I think that is what you are looking for

mariusanhalt Jul 22, 2011 12:51 PM

Strange again..

It still dont work, I followed your guid, and the widget works fine, but the script does not, I also tried another adsense that I have (working) on an other site with atahualpa (older version), and that does not work there either, very wierd..

At lilledanmark.dk (the link to the site further up) You can see in any post just under the byline the words "test test", they are text inserted in the widget, so it works. But between the "text (HERE) text" I inserted the script, and it does not show, not on my com anyway, what about yours??

juggledad Jul 22, 2011 01:15 PM

I actually put your code
HTML Code:

<center><script type="text/javascript"><!--
google_ad_client = "ca-pub-7222158511372648";
/* banner lilledanmark */
google_ad_slot = "4178770608";
google_ad_width = 728;
google_ad_height = 90;
//-->

</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">

</script></center>
<p align="center"><font size="1" color="#808080">Ses bedst i 1024x768 eller
derover</font></p>

In and it was working. I put this in a text widget.

Remember, if you used the if statement, it will only show on a single post page

mariusanhalt Jul 23, 2011 12:06 AM

Just tried that too..

perhaps I should try to uninstall both wordpress and Atahualpa, and then reinstall to see if that should help, perhaps something went wrong back then..

mariusanhalt Jul 23, 2011 12:49 AM

-2-

Okay, I updatet wordpress to newest version, that did not help..

Then I said grr"&¤(=/#&umf, uninstalled Atahualpa and reinstalled it in 3.5.3, reset alle theme options, and started all over.
And aparently it works in 3.5.3 now, so I will stay here a bit before I change again..

Thanks for your effort JD, you are a god.

juggledad Jul 23, 2011 05:33 AM

you can have 2 versions of the theme installed, just put them in different folders like atahualpa353 and atahualpa367 then you can switch back and forth, see HOWTO: upgrade Atahualpa to a new version

I don't think you should give up on 367 since I got your AD's to show on my site, I'll bet it is something very simple that is missing. If you wish to continue trying, let me know.

mariusanhalt Jul 25, 2011 04:45 AM

Actually I still have 367 in the amongst themes so I can change, just as you say.

Sure, if you have any ideas, I'm ready to try. I too belive it must be something "simple", because I can make it work outside the coding (as said in a former post, in the very very top of index.php before anything else.), and that is fun.
De- and Re-installing 367 did not help, just tried that.

Alongside, I'm working on 364, there it works to, and then the work wont have to stop in the meantime.

juggledad Jul 25, 2011 05:37 AM

If you want me to take a look, send me a PM with an admin id/pw


All times are GMT -6. The time now is 08:59 AM.

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