I'm trying to put a small gallery in my header but can't code it for wordpress. Here's the static site mock-up. On mouse-over, the colored jpg fades in, and when clicked it opens up in a colorbox. If I just cut and paste this into my header.php file, I get a 404. Here's the failed wp version. If it helps, here is the failed code from the wp conversion attempt:
<?php /** * The Header for our theme. * * Displays all of the <head> section and everything up till <div id="main"> * * @package WordPress * @subpackage Starkers * @since Starkers 3.0 */ ?><!DOCTYPE html> <html <?php language_attributes(); ?>> <head> <meta charset="<?php bloginfo( 'charset' ); ?>" /> <title><?php wp_title( '|', true, 'right' ); ?></title> <link rel="profile" href="http://gmpg.org/xfn/11" /> <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" /> <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" /> <?php wp_enqueue_script('jquery'); ?>
Well thanks for looking, but you probably clicked on the static site link, which does work, because the "failed wp version" is definitely messed in all browsers, I'm sure it's coded wrong. I also notice when I click an image it trys to open it in [url]/images/picturename.jpg, and the next time I click an image it opens as [url]/images/images/picturename.jpg, adding a new /images each time. Weird.
Some progress: I realize now I can't link images in WP with relative links, so I switched to href="<?php bloginfo( 'template_url' ); ?>/images...etc. so they're loading now...I just can't get my javascript to work, even when I try running the script in the header.php itself.
I have had some issues with wp not loading jQuery 'right'. I have even seen it in the correct place in the head.. but it just didn't fly. I just load it direct from Google APIs. I get much better results this way. Dunno why that should make a difference.
Thanks swirv, I'm glad I'm not the only one. I was bouncing back between my own jquery and google's trying to make things work, so I'm back to using google's, but no change. I know the images are loading correctly now, so that's a start. Here's what I have so far: 1. When I view the source, the scripts seem to be loading and in the intended order: Jquery, colorbox, wp_head, my script. (If that's wrong, let me know) 2. I'm using the exact same scripts as the html mock-up, which DOES work. 3. Firebug error: "$ is not a function" and pointing to my $(document).ready(function(){ statement. I think that would suggest jquery is not loading, but it is.
What the-- Last night I looked at the site again and two of the pages started working correctly, but not the others. Today it's all working correctly. (apologies to dclardy, you were probably right) Problem is, I HAVEN'T CHANGED ANY $%#@!ING CODE!! This is not the first time I've posted a problem that suddenly corrected itself for no reason two weeks later. I think at this point I have to blame my host right? I mean, I know it's a heavy site right now-I'm not optimizing until I get thing to work right, but I have scripts and images not loading randomly, until it's been up a week or two. Has anyone else had this experience? Anyway, I'm not posting here anymore until I've switched to a host that's worth crap. Thanks for your help.
I'm not totally new to Wp, but there's obviously a few things I don't get yet. Thanks for your help.
I have had some issues with wp not loading jQuery 'right'. I have even seen it in the correct place in the head.. but it just didn't fly. I just load it direct from Google APIs. I get much better results this way. Dunno why that should make a difference.
Good Luck
swirv
1. When I view the source, the scripts seem to be loading and in the intended order: Jquery, colorbox, wp_head, my script. (If that's wrong, let me know)
2. I'm using the exact same scripts as the html mock-up, which DOES work.
3. Firebug error: "$ is not a function" and pointing to my $(document).ready(function(){ statement. I think that would suggest jquery is not loading, but it is.