Grow your CSS skills. Land your dream job.

WordPress conversion problem

  • # October 11, 2010 at 5:36 pm

    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 section and everything up till

    *
    * @package WordPress
    * @subpackage Starkers
    * @since Starkers 3.0
    */
    ?>< !DOCTYPE html>
    >






    < ?php wp_enqueue_script('jquery'); ?>

    < ?php if ( is_singular() && get_option( 'thread_comments' ) )
    wp_enqueue_script( 'comment-reply' );
    wp_head();
    ?>





    >







    I’m not totally new to Wp, but there’s obviously a few things I don’t get yet. Thanks for your help.

    # October 11, 2010 at 5:38 pm

    I started with a Starkers theme, btw, which might be part of my problem, I don’t know.

    # October 12, 2010 at 2:32 pm

    It looks it is working on my end. I am using Chrome.

    # October 12, 2010 at 11:27 pm

    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 /images/picturename.jpg, and the next time I click an image it opens as /images/images/picturename.jpg, adding a new /images each time. Weird.

    # October 18, 2010 at 5:25 pm

    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.

    # October 18, 2010 at 6:44 pm

    Hey Eric, What happens when you leave out wp_enqueue_script(‘jquery’); and replace that with:

    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

    # October 20, 2010 at 3:26 pm

    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.

    # October 21, 2010 at 12:33 pm

    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.

    cjk
    # October 22, 2010 at 5:07 pm

    Cache?

    # October 23, 2010 at 3:28 pm

    Emptied. Several times. Different browsers. The works.

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".