WordPress.org

Forums

Coda Slider not working with Static Page (5 posts)

  1. anandpadia
    Member
    Posted 4 years ago #

    Hi,

    I am not able to have posts work in coda slider on my main page. My main page is a static page and index page includes other posts apart from posts from my main page in a slider fashion.

    Now the slider is working just fine with the index page data however with the static page it does not seem to work.

    I am not sure if its a problem with the slider or the static page coding.

    Below is the code for my static page.

    <?php
    /*
    Template Name: more
    */
    ?>
    
    <?php get_header(); ?>
    <div id="mid" class="index">
    <!-- Start slider -->
    <div class="stripViewer">
    <div class="panelContainer">
    
    <?php wp_reset_query(); query_posts('posts_per_page=6'); if (have_posts()) : ?>
    
    <?php while (have_posts()) : the_post(); ?>
    
    <div class="panel" id="post-<?php the_ID(); ?>" title="<?php the_title() ?>">
    <div class="wrapper">
    <?php
    $media_type = get_post_meta($post->ID, 'lead_type', true);
    $media = get_post_meta($post->ID, 'lead_image', true);
    /* Display relevant code based on media type */
    if(stristr($media, '.flv') || $media_type == 'flash') {
    /* Grab video preview image if the user has added one */
    $video_preview = get_post_meta($post->ID, 'video_preview', true); ?>
    <span id="video-<?php the_ID(); ?>" class="flashvideo" style="height: 600px; width: 940px;">
    <script type="text/javascript">
    var s<?php the_ID(); ?> = new SWFObject("<?php bloginfo('template_directory'); ?>/flash/player.swf","n0","940","600","7");
    s<?php the_ID(); ?>.addParam("allowfullscreen","true");
    s<?php the_ID(); ?>.addParam("allowscriptaccess","always");
    s<?php the_ID(); ?>.addParam("wmode","transparent");
    s<?php the_ID(); ?>.addVariable("javascriptid","n0");
    s<?php the_ID(); ?>.addVariable("height","600");
    s<?php the_ID(); ?>.addVariable("width","940");
    s<?php the_ID(); ?>.addVariable("searchbar","false");
    s<?php the_ID(); ?>.addVariable("screencolor","0x000000");
    s<?php the_ID(); ?>.addVariable("overstretch","true");
    s<?php the_ID(); ?>.addVariable("showeq","false");
    s<?php the_ID(); ?>.addVariable("showicons","true");
    s<?php the_ID(); ?>.addVariable("shownavigation","true");
    s<?php the_ID(); ?>.addVariable("showstop","false");
    s<?php the_ID(); ?>.addVariable("showdigits","true");
    s<?php the_ID(); ?>.addVariable("showdownload","false");
    s<?php the_ID(); ?>.addVariable("usefullscreen","true");
    s<?php the_ID(); ?>.addVariable("autoscroll","false");
    s<?php the_ID(); ?>.addVariable("displayheight","600");
    s<?php the_ID(); ?>.addVariable("thumbsinplaylist","true");
    s<?php the_ID(); ?>.addVariable("autostart","false");
    s<?php the_ID(); ?>.addVariable("bufferlength","3");
    s<?php the_ID(); ?>.addVariable("repeat","false");
    s<?php the_ID(); ?>.addVariable("rotatetime","5");
    s<?php the_ID(); ?>.addVariable("shuffle","false");
    s<?php the_ID(); ?>.addVariable("smoothing","true");
    s<?php the_ID(); ?>.addVariable("volume","100");
    s<?php the_ID(); ?>.addVariable("enablejs","true");
    s<?php the_ID(); ?>.addVariable("linkfromdisplay","false");
    s<?php the_ID(); ?>.addVariable("linktarget","_self");
    s<?php the_ID(); ?>.addVariable("searchlink","http://search.longtail.tv/?q=");
    s<?php the_ID(); ?>.addVariable("file","<?php echo $media; ?>");
    s<?php the_ID(); ?>.addVariable("image","<?php echo $preview_image; ?>");
    s<?php the_ID(); ?>.write("video-<?php the_ID(); ?>");
    </script>
    </span>
    
    <? } elseif(stristr($media, 'iframe') || $media_type == 'iframe') {
    
    /* Insert Iframe directly, stripping slashes from links etc */
    
    echo stripslashes($media);
    
    } else {
    
    /* Else default behaviour is to display image */ ?>
    
    <img src="<?php echo $media; ?>" alt="" width="940" height="600" />
    
    <? }
    ?>
    
    <div class="post-title">
    <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
    </div>
    <div class="entry">
    <?php the_excerpt(); ?>
    </div>
    </div>
    </div>
    
    <?php endwhile; ?>
    
    <?php else : ?>
    
    <?php endif; ?>
    
    </div><!-- .panelContainer -->
    </div><!--.stripViewer -->
    
    </div><!-- .mid -->
    
    <div class="stripNavL" id="stripNavL0"><a href="#"><img src="<?php bloginfo('template_directory'); ?>/images/left.png" alt="Left" /></a></div>
    <div class="stripNavR" id="stripNavR0"><a href="#"><img src="<?php bloginfo('template_directory'); ?>/images/right.png" alt="Right" /></a></div>
    
    <center><table style="width: 940px" class="bgcolor" align="center">
    <tr>
    <td colspan="3">&nbsp;</td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td>
    <?php if(function_exists('adsensem_ad')){ adsensem_ad("bigs"); } ?>&nbsp;
    <?php if(function_exists('adsensem_ad')){ adsensem_ad("shaadibs"); } ?>&nbsp;
    <?php if(function_exists('adsensem_ad')){ adsensem_ad("branchrbox"); } ?></td>
    <td>&nbsp;</td>
    </tr>
    <tr>
    <td colspan="3">&nbsp;</td>
    </tr>
    </table></center>
    
    <?php query_posts('posts_per_page=6&offset=3'); $count = 1; if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div id="mid" class="single">
    <div class="panel-single" id="post-<?php the_ID(); ?>" title="<?php the_title() ?>">
    <div class="wrapper">
    <?php $image = get_post_meta($post->ID, 'single_image', true); if ($image=="") { $image = get_post_meta($post->ID, 'lead_image', true); }
    $media_type = get_post_meta($post->ID, 'lead_type', true);
    if ($media_type != 'flash') { ?>
    <img src="<?php echo $image; ?>" alt="" width="940" height="300" />
    <? } ?>
    <div class="post-title-single">
    <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
    </div>
    </div>
    </div>
    </div>
    <?php if ($count == 3) : ?>
    
    <center><a href="http://feeds.feedburner.com/Jagmag"><img alt="" src="http://jagmag.co.cc/wp-content/themes/viewport_1.1/viewport/images/subrss.png" border="0" /></a><?php if(function_exists('adsensem_ad')){ adsensem_ad("branchrwide"); } ?></center>
    
    <?php endif; $count++; ?>
    <?php endwhile; else: ?>
    
    <p>Sorry, no posts matched your criteria.</p>
    
    <?php endif; ?>      
    
    <?php wp_reset_query(); ?>
    <center><?php if(function_exists('adsensem_ad')){ adsensem_ad("longmain"); } ?><a href="http://jalwa.co.cc/"><img alt="" src="http://jagmag.co.cc/wp-content/themes/viewport_1.1/viewport/images/jalwaad.gif" border="0" /></a></center>
    
    <?php get_footer(); ?>

    Please help.

  2. anandpadia
    Member
    Posted 4 years ago #

    I guess I have posted the question in a wrong section... Please anyone help me...

  3. pils.schouler
    Member
    Posted 4 years ago #

    hello anan

    please don't confuse me with someone who knows what they're doing but I've got the above to work, though with variation:

    index.php

    <?php get_header(); ?>
    
    	<div id="mid" class="index">
    
    		<!-- Start slider -->
    		<div class="stripViewer">
    			<div class="panelContainer">
    
    			<?php if (have_posts()) : ?>
    
    				<?php while (have_posts()) : the_post(); ?>
    
    				<div class="panel" id="post-<?php the_ID(); ?>" title="<?php the_title() ?>">
    					<div class="wrapper">
    
    <?php
    $media_type = get_post_meta($post->ID, 'lead_type', true);
    $media = get_post_meta($post->ID, 'lead_image', true);
    /* Display relevant code based on media type */
    if(stristr($media, '.flv') || $media_type == 'flash') {
    /* Grab video preview image if the user has added one */
    $video_preview = get_post_meta($post->ID, 'video_preview', true); ?>
    <span id="video-<?php the_ID(); ?>" class="flashvideo" style="height: 600px; width: 940px;">
    <script type="text/javascript">
    var s<?php the_ID(); ?> = new SWFObject("<?php bloginfo('template_directory'); ?>/flash/player.swf","n0","940","600","7");
    s<?php the_ID(); ?>.addParam("allowfullscreen","false");
    s<?php the_ID(); ?>.addParam("allowscriptaccess","always");
    s<?php the_ID(); ?>.addParam("wmode","transparent");
    s<?php the_ID(); ?>.addVariable("javascriptid","n0");
    s<?php the_ID(); ?>.addVariable("controlbar","none");
    s<?php the_ID(); ?>.addVariable("stretching","fill");
    s<?php the_ID(); ?>.addVariable("height","600");
    s<?php the_ID(); ?>.addVariable("width","940");
    s<?php the_ID(); ?>.addVariable("searchbar","false");
    s<?php the_ID(); ?>.addVariable("screencolor","0xffffff");
    s<?php the_ID(); ?>.addVariable("overstretch","true");
    s<?php the_ID(); ?>.addVariable("showeq","false");
    s<?php the_ID(); ?>.addVariable("showicons","false");
    s<?php the_ID(); ?>.addVariable("shownavigation","false");
    s<?php the_ID(); ?>.addVariable("showstop","false");
    s<?php the_ID(); ?>.addVariable("showdigits","false");
    s<?php the_ID(); ?>.addVariable("showdownload","false");
    s<?php the_ID(); ?>.addVariable("usefullscreen","true");
    s<?php the_ID(); ?>.addVariable("autoscroll","false");
    s<?php the_ID(); ?>.addVariable("thumbsinplaylist","false");
    s<?php the_ID(); ?>.addVariable("autostart","false");
    s<?php the_ID(); ?>.addVariable("bufferlength","3");
    s<?php the_ID(); ?>.addVariable("repeat","false");
    s<?php the_ID(); ?>.addVariable("rotatetime","5");
    s<?php the_ID(); ?>.addVariable("shuffle","false");
    s<?php the_ID(); ?>.addVariable("smoothing","true");
    s<?php the_ID(); ?>.addVariable("volume","100");
    s<?php the_ID(); ?>.addVariable("enablejs","true");
    s<?php the_ID(); ?>.addVariable("linkfromdisplay","false");
    s<?php the_ID(); ?>.addVariable("linktarget","_self");
    s<?php the_ID(); ?>.addVariable("image","<?php echo $preview_image; ?>");
    s<?php the_ID(); ?>.addVariable("file","<?php echo $media; ?>");
    s<?php the_ID(); ?>.write("video-<?php the_ID(); ?>");
    </script>
    </span>
    
    <? } elseif(stristr($media, 'iframe') || $media_type == 'iframe') {
    
    /* Insert Iframe directly, stripping slashes from links etc */
    
    echo stripslashes($media);
    
    } else {
    
    /* Else default behaviour is to display image */ ?>
    
    <img src="<?php echo $media; ?>" alt="" width="940" height="600" />
    
    <? }
    ?>
    
    						<!-- <?php $image = get_post_meta($post->ID, 'lead_image', true); ?> -->
    						<!-- <img src="<?php echo $image; ?>" alt="" width="940" height="600" />  -->
    
    						<div class="post-title">
    							<!-- <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"> -->
    							<?php the_title(); ?>
    							<!-- </a> -->
    						</div>
    						<div class="entry">
    							<?php the_content(); ?>
    						</div>
    					</div>
    				</div>
    
    <?php endwhile; ?>
    
    <?php else : ?>
    
    <?php endif; ?>
    
    				<div class="panel" id="nav-panel">
    					<div class="wrapper">
    						<img src="<?php bloginfo('template_directory'); ?>/images/where.jpg" alt="" width="940" height="600" />
    						<div class="post-title">
    							Where next?
    						</div>
    						<div class="entry">
    							<span class="big"><a href="<?php bloginfo('comments_rss2_url'); ?>" class="rss-big">Recent Comments</a></span>
    							<ul><li></li><?php dp_recent_comments(); ?></ul>
    							<span class="big"><span class="left"><?php previous_posts_link('&laquo; Newer Entries') ?></span>
    							<span class="right"><?php next_posts_link('Older Entries &raquo;') ?></span></span>
    						</div>
    					</div>
    				</div>
    
    			</div><!-- .panelContainer -->
    		</div><!--.stripViewer -->
    
    	</div><!-- .mid -->
    
    	<div class="stripNavL" id="stripNavL0"><a href="#"><img src="<?php bloginfo('template_directory'); ?>/images/left.png" alt="Left" /></a></div>
    	<div class="stripNavR" id="stripNavR0"><a href="#"><img src="<?php bloginfo('template_directory'); ?>/images/right.png" alt="Right" /></a></div>
    
    <?php get_footer(); ?>

    header.php (for js files):

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
    
    <head profile="http://gmpg.org/xfn/11">
    <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
    
    <title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> &raquo; Blog Archive <?php } ?> <?php wp_title(); ?></title>
    
    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
    <link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
    <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
    
    <?php if(is_home() || is_category()) : ?>
    	<script src="<?php bloginfo('template_directory'); ?>/js/jquery-1.2.1.pack.js" type="text/javascript"></script>
    	<script src="<?php bloginfo('template_directory'); ?>/js/jquery-easing.1.2.pack.js" type="text/javascript"></script>
    	<script src="<?php bloginfo('template_directory'); ?>/js/jquery-easing-compatibility.1.2.pack.js" type="text/javascript"></script>
    	<script src="<?php bloginfo('template_directory'); ?>/js/coda-slider.1.1.1.js" type="text/javascript"></script>
    	<script src="<?php bloginfo('template_directory'); ?>/js/swfobject2.js" type="text/javascript"></script>
    	<script src="<?php bloginfo('template_directory'); ?>/js/scale.js" type="text/javascript"></script>
    	<script type="text/javascript">
    		jQuery(window).bind("load", function() {
    			jQuery("div#mid").codaSlider()
    		});
    	</script>
    
    	<script src="<?php bloginfo('template_directory'); ?>/js/imgSizer.js" type="text/javascript"></script>
    
    <?php endif; ?>
    
    <?php if(get_background()!="") : ?>
    <style type="text/css">
    	body {
    		background: <?php echo get_background(); ?>;
    	}
    </style>
    <?php endif; ?>
    
    <?php wp_head(); ?>
    </head>
    <body>
    <div id="page">
    
    <div id="header">
    	<!-- <h1><a href="<?php echo get_option('home'); ?>/"><?php bloginfo('name'); ?></a></h1> -->
    <h1><a href="<?php echo get_option('home'); ?>/"><img src="<?php bloginfo('template_url'); ?>/images/logo.png"></a></h1>

    The only thing I've failed to get to work (that I tried to) was the preview_image...

    Hope you get this, or you've worked it out.

    kindest

    pils

  4. Calicosun
    Member
    Posted 4 years ago #

    Hi anandpadia. Did you manage to get this to work? I have a similar problem - using viewpoint theme and unable to get the slider to work on a static page with a template applied ie.

    1. Created a template called work.php (template name: work)
    2. Copied code from index file (similar to what is above) into work.php file
    3. Created a page called 'work' and applied the work template to it.
    4. Created a category called work and added <?php query_posts( 'cat=3' ); ?> to the loop to call just the work categories.
    5. Created several posts and applied the work category
    6. Set up 'work' link in menu (using appearance/menu).
    7. Clicked on 'work' link and the first post with work category applied displays but when you click on the left/right arrow the slider doesn't work.

    It works fine using the <?php query_posts( 'cat=3' ); ?> on the index page and going to http://www.sitename.com/# but not when called post into a static page.

    I know nothing about JQuery scripts so have no idea where to even start in solving this.

    pils.schouler - I tried copying and pasting your revised code (couldn't figure out what changes you made) but that didn't work either... but thanks for the help anyway.

    Any more ideas anyone?

  5. pils.schouler
    Member
    Posted 4 years ago #

    Hi Calicosun

    I'll be v.honest, I've completely forgotten what the heck I did with the above...soz...

    :[

Topic Closed

This topic has been closed to new replies.

About this Topic