Wordpress how to retrieve the post id once its been reset in the page

Posted by Scott B on Stack Overflow See other posts from Stack Overflow or by Scott B
Published on 2010-04-08T15:47:42Z Indexed on 2010/04/08 15:53 UTC
Read the original article Hit count: 187

Filed under:
|

I'm working with a script in which the postid of the page has been reset via a script include. How can I retrieve the actual true post id and reset its value once it has been changed via script?

Here is the script that I'm referring to. Somewhere in there, the postid is being reset so that the page's the_content() call is no longer pulling the current page being viewed.

                <?php 

                    //$featpages = get_option('woo_slider_pages_landing');
                    $featpages = '579,584,537';
                    $featarr=split(",",$featpages);
                    $featarr = array_diff($featarr, array(""));

                    $i = 1;

                    foreach ( $featarr as $featured_tab ) {

                     query_posts('page_id=' . $featured_tab); while (have_posts()) : the_post();    

                ?>      

            <div class="featured-slide" id="slide-<?php echo $i; $i++; ?>" <?php if($i >=3 ){echo 'style="display:none"';} ?>>

                <div class="text">

                    <h2><?php if ( get_post_meta($post->ID, "page_desc", $single = true) <> "" ) { echo get_post_meta($post->ID, "page_desc", $single = true); } else { the_title(); } ?></h2>

                    <p><?php if ( get_post_meta($post->ID, "page_excerpt", $single = true) <> "" ) { echo get_post_meta($post->ID, "page_excerpt", $single = true); } else { the_excerpt(); } ?></p>

                        <?php if ( get_post_meta($post->ID, "link_text", $single = true) <> "" and get_post_meta($post->ID, "link_link", $single = true) <> "" ) { ?>

                        <p><a href="<?php echo get_post_meta($post->ID, "link_link", $single = true); ?>" title="<?php echo get_post_meta($post->ID, "link_text", $single = true); ?>"><?php echo get_post_meta($post->ID, "link_text", $single = true); ?></a></p>

                        <?php } ?>                                  

                </div><!-- /.text -->

                <?php if ( get_post_meta($post->ID, "image", $single = true) <> "" ) { ?>

                <div class="image">

                    <img src="<?php echo get_post_meta($post->ID, "image", $single = true); ?>" alt="<?php the_title(); ?>" class="featured" />

                </div><!-- /.image -->

                <?php } ?>

            </div><!-- /.featured-slide -->

            <?php endwhile; } //endforeach ?>

© Stack Overflow or respective owner

Related posts about php

Related posts about Wordpress