Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter jschleuss

    (@jschleuss)

    That would work if I only had a few posts. But I’d have about 400 images and 400 sets of coordinates to input by hand. I don’t have time to do all that. I’d like to figure out a way to have it built in PHP and run whenever a new post is created.

    In non-code terms this is what I’m trying to figure out:

    when a new post is published run:
    loop through all posts
    if (post has thumbnail) { add post thumbnail to image sprite, copy coordinates inside sprite }
    end loop
    append css for sprite coordinates, clear css browser cache

    As an alternative, I’m also just trying to figure out how to speed up my page load time for the homepage and all image-populus pages. I currently average 4.25 seconds for the homepage to load.

    This is awesome, but I’m not sure how to implement a similar option using the wp_nav_menu tag. I’m not very familiar with PHP.

    This is what I have. I get a parse error if I use another <?php ?> inside for the class of the span. Any ideas on how to make it work for this template tag?

    <?php
    $style_classes = array('first','second','third','fourth');
    $style_index = 0;
    ?>
    
    <?php wp_nav_menu( array( 'container_class' => 'menu-header', 'before' => '<span class="$k = $style_index%3; echo "class=$style_classes[$k]"; $style_index++;">', 'after' => '</span>' ) ); ?>
Viewing 2 replies - 1 through 2 (of 2 total)