Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Header configuration & styling »

Using bar1 or bar2 for Javascript?


  #1  
Old Sep 29, 2009, 05:40 PM
paulae's Avatar
paulae
 
1,333 posts · Feb 2009
Wordpress 3.4.1, Atahualpa 3.7.7
In trying to make my page load faster, and especially to make the very beginning of the page to show up faster without a long lag-time, I'm trying to make the things that load first be very light-weight. I had a plugin in the left sidebar to show the current date, as any news site should have. Plugins seem to be rather heavy in the way they use the browser, so I am looking for another way. Ideally, I would like the date to show up below the top banner ad, which would be a nice location for bar1. I would like to be able to put Javascript in there, like this:
Quote:
<script language="javascript" type="text/javascript">
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thu rsday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May"," June","July","August","September","October","Novem ber","December")
document.write("<small><font color='FFFFFF' face='Arial'><b>"+dayarray[day]+", "+montharray[month]+" "+daym+", "+year+"</b></font></small>")
</script>
At the moment, I've inserted it into the HTML Insert area for the header, and it's showing up at the very top of the container. Not where I want it, ultimately.

Any way I can do what I want? I saw a thread earlier about putting text in the /functions/bfa_ata_header_config.php file where the bar code is, but I don't know how to put Javascript there without ending up with an ugly parse error.
  #2  
Old Sep 29, 2009, 07:18 PM
BradBrown's Avatar
BradBrown
 
54 posts · Mar 2009
You don't have to use Javascript at all. Another option is to use PHP to populate the date on the server side. Just put something like the following where you want the date to show up:

PHP Code:
<?php echo date("l F j, Y");?>
(Of course, this has to be somewhere you're allowed to use PHP--like many of the ATA areas or in a PHP widget.)

This would make your pages a bit smaller, and make the date show up even if the user has Javascript turned off.

Last edited by BradBrown; Sep 29, 2009 at 07:28 PM.
  #3  
Old Sep 30, 2009, 06:11 AM
paulae's Avatar
paulae
 
1,333 posts · Feb 2009
Wordpress 3.4.1, Atahualpa 3.7.7
Hi, and thanks.

Yes, I had a PHP plugin in a widget in the left sidebar, showing the date. I was trying to get rid of as many plugins as possible, so at least your method would dispense with one, while still showing the date.

I get the idea of showing the date even if the user's JS is turned off, but there is so much JS all over the theme, and I guess in Wordpress, that surely that can't be much of an issue.

I'm also trying to avoid adding code to the theme files except via the theme options. Those who will manage the site after me are not going to feel comfortable doing that, I know.
  #4  
Old Sep 30, 2009, 12:47 PM
BradBrown's Avatar
BradBrown
 
54 posts · Mar 2009
You don't have to edit theme files or use a plug-in. You said you wanted to put it in the header. You can put the PHP code (or the Javascript, for that matter) directly in the ATA Options->Style & Configure HEADER AREA->Configure Header Area box.

I just mentioned the PHP widget because it might be useful to others who read this thread.

Bookmarks



Similar Threads
Thread Thread Starter Forum Replies Last Post
Content into Header Bar %bar1 Steve_T Header configuration & styling 14 Apr 7, 2012 10:10 PM
[SOLVED] Aesthetic Changes - Adding Image To Bar1, Adjusting Footer/Copyright Layout mannitol Atahualpa 3 Wordpress theme 8 Oct 3, 2009 03:03 AM
[SOLVED] How to import a widget' into %bar1 or 2 ? Sakshin Page & Category Menu Bars 2 Sep 15, 2009 07:18 PM
[SOLVED] Bar2 Navigation: How To Impliment rockport Header configuration & styling 4 Jun 12, 2009 11:59 AM
Minimum size for bar1 / bar2 in windows? mcphoto Header configuration & styling 2 May 11, 2009 04:36 PM


All times are GMT -6. The time now is 11:22 PM.


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