I know this is very avant-garde, but bear with me.
I’ve read that one is able to query a page by the page/post name or slug. I’m trying to do this because I need information from a page with a similar title/slug and will not have the ability to get the page id (unless there’s a way to convert a title to an ID).
I’ve tried multiple variations without success. This seems like the most reasonable way of handling this, but it’s simply not working.
<?php
$args = array(
'pagename' => 'CM-145',
'post_type' => 'page',
'posts_per_page' => 1,
'numberposts' => 1
); ?>
<div>
<?php
query_posts( $args );
get_template_part( 'loop' );
wp_reset_query();
?>
</div>
The Loop
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php if ( is_front_page() ) { ?>
<h2 class="entry-title"><?php the_title(); ?></h2>
<?php } else { ?>
<h1 class="entry-title"><?php the_title(); ?></h1>
<?php } ?>
<div class="entry-content">
<?php the_content(); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
<?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="edit-link">', '</span>' ); ?>
</div><!-- .entry-content -->
</div><!-- #post-## -->
<?php comments_template( '', true ); ?>
<?php endwhile; // end of the loop. ?>
I’ve also tried 'name' => 'CM-145'
, I’m not sure if this is the correct or reasonable way to perform this action. Ultimately I simply need to pull the page’s thumb and excerpt so if you have a better Idea don’t hesitate to let me know.
Thanks in advance.