WordPress.org

Ready to get started?Download WordPress

Forums

img src isn't working in my header.php, trying to get a slideshow (3 posts)

  1. sabster
    Member
    Posted 1 year ago #

    hey guys, i'm trying to build a slideshow on my wordpress page using the header.php but none of the <img src="url"> is working on my homepage at all?

    this is below my navigation on my header.php page:

    <!-- slideshow -->
    <script type="text/javascript">
    
    /***
        Simple jQuery Slideshow Script
        Released by Jon Raasch (jonraasch.com) under FreeBSD license: free to use or modify, not responsible for anything, etc.  Please link out to me if you like it :)
    ***/
    
    function slideSwitch() {
        var $active = $('#slideshow IMG.active');
    
        if ( $active.length == 0 ) $active = $('#slideshow IMG:last');
    
        // use this to pull the images in the order they appear in the markup
        var $next =  $active.next().length ? $active.next()
            : $('#slideshow IMG:first');
    
        // uncomment the 3 lines below to pull the images in random order
    
        // var $sibs  = $active.siblings();
        // var rndNum = Math.floor(Math.random() * $sibs.length );
        // var $next  = $( $sibs[ rndNum ] );
    
        $active.addClass('last-active');
    
        $next.css({opacity: 0.0})
            .addClass('active')
            .animate({opacity: 1.0}, 1000, function() {
                $active.removeClass('active last-active');
            });
    }
    
    $(function() {
        setInterval( "slideSwitch()", 5000 );
    });
    
    </script>
    <img src="slideshow1.png">
    			<div id="frontpageslideshow">
        			 <img src="/themepics/slideshow1.png" alt="" class="active" />
        			 <img src="/themepics/slideshow/slideshow2.jpg" alt="" />
    			</div><!-- end slideshow -->
    <img src="nav-bg.png" style="height:100%;width:100%;">

    and then here's the matching css:

    #frontpageslideshow {
        position:relative;
        height:322px;
        width:822px;
    }
    
    #frontpageslideshow IMG {
        position:absolute;
        top:0;
        left:0;
        z-index:8;
        opacity:0.0;
    }
    
    #frontpageslideshow IMG.active {
        z-index:10;
        opacity:1.0;
    }
    
    #frontpageslideshow IMG.last-active {
        z-index:9;
    }

    and my images are located here:
    themes/twentyten-child/slideshow/

    i tried to test images overall and i couldn't even put in images anywhere on my header.php file at all.

    i took the slideshow code from this tutorial because i'm going for a certain look..this one is very simple and all i need: http://jonraasch.com/blog/a-simple-jquery-slideshow

    but does anyone know why even the img src tag isn't working? i tried multiple images in different directories, even the same directory, and i even tried linking images outside of my site from the internet and the img src code still wasn't working.

    what is the deal?

  2. zex2911
    Member
    Posted 1 year ago #

    <img src="<?php echo get_stylesheet_directory_uri() ?>/slideshow/slideshow1.png" alt="first image">
    this should work. Just change every image path you need, but you have to echo stylesheet directory, than folder that contains images, and then image name. Hope that helps. :)

  3. sabster
    Member
    Posted 1 year ago #

    yes ZEX, that fixed it man... thanks bro. these damn wordpress functions driving me crazy... lol

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.