WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Cant get other pages loading posted infor (2 posts)

  1. jkkenzie
    Member
    Posted 1 year ago #

    my index.php has this code: which works

    <?php while ( have_posts() ) : the_post(); ?>
                       <?php if( get('top_left_title') != "" ) { ?>
                       		<h1><?php echo get('top_left_title'); ?> </h1>
                       <div id="line">&nbsp;</div>
                       <?php echo get('top_left_info'); ?>
                       <div id="line">&nbsp;</div>
                       <?php } ?>
                        <?php endwhile; ?>

    But when click the menu "About us" which uses default template page.php
    with same code as above, it does show any result.

  2. jkkenzie
    Member
    Posted 1 year ago #

    I have solved that part: as follows:

    $temp2 = $wp_query2;
    $wp_query2= null;
    $wp_query2 = new WP_Query();
    $wp_query2->query('showposts=5'.'&paged='.$paged);
    
    get_header(); ?>
    		<div id="leftcol">
                     <div id="upper-section" >
                     <?php if ( $wp_query2->have_posts() ) : ?>    
    
                                <?php while ( $wp_query2->have_posts() ) : $wp_query2->the_post(); ?>
                               <?php if( get('top_left_title') != "" ) { ?>
                                    <h1><?php echo get('top_left_title'); ?> </h1>
                               <div id="line">&nbsp;</div>
                               <?php echo get('top_left_info'); ?>
                               <div id="line">&nbsp;</div>
                               <?php } ?>
                                <?php endwhile; ?>
                     </div>

Topic Closed

This topic has been closed to new replies.

About this Topic