• Hi

    I’m using the ‘On-Demand’ theme for a client’s website. You may visit my website at https://www.sozocinemas.com. I need to use “if else if” statement inside the page template (page.php) to display content from different pages when on different pages. I had to go this much out of way because of this reason:
    I wanted to display the carousel header on all pages (not just on the home page). But once I included the carousel in the header of the page template (page.php) my content for each page would disappear and, instead, content of the posts in the carousel page would appear on the pages.

    I’m using this code:

    <?php get_header(); ?>
    <?php $aOptions = OnDemand::initOptions(false); ?>
    
    <div id="featured">
            <div id="slider">
                <div class="scroll">
                    <div class="scrollContainer">
                    <?php if ($aOptions['featured-cat'] != '') { query_posts('cat=' . $aOptions['featured-cat'] . '&amp;showposts=' . $aOptions['featured-count']); } ?>
                    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
                        <div class="panel" id="post-<?php the_ID(); ?>" style="background: url(<?php $key="featuredimage"; echo get_post_meta($post->ID, $key, true); ?>) top left no-repeat;">
                            <div class="insert">
    
                                <a href="<?php the_permalink() ?>" title="<?php the_title() ?>"><div class="watchnow"></div></a>
                            </div>
                        </div>
                    <?php endwhile; else: ?>
                    <?php endif; ?>
                    </div>
                </div>
            </div>
        </div>
    
        <div id="pagewrap">
        	<div id="content">
                <div id="contentleft">
    
                    <div id="bloglist">
    	<div class="pageitem">
    <strong><?php query_posts('page_id=2'); ?></strong>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
                        	<h2><a href="<?php the_permalink() ?>" title="<?php the_title() ?>"><?php the_title() ?></a></h2>
                        	<div class="blogcontent">
    							<?php the_content(''); ?>
                            </div>
    <?php endwhile; else: ?>
                    <?php endif; ?>
    
    </div>
    
    <?php if ( is_page('coming-soon') ) { include ('showing.php'); } ?>
                    </div>
                </div>
    
                <div id="contentright">
                    <?php include (TEMPLATEPATH . '/sidebar-page.php'); ?>
                </div>
            </div>
    	</div>
    
    <?php get_footer(); ?>

    But as you see, the query_post would display content from my “about’ page on all the other pages as well. So I thought of the “if elseif” statement. But can’t get it to work.
    Help would be most appreciated!

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘“if else if” to display content from different pages’ is closed to new replies.