You're going to need to learn how to create a custom page template and use a meta_query. To ensure your new page template includes all the other elements you want, I would suggest starting by copying a template file (such as page.php
) that works the way you want to already (as far as structure and includes). You're going to gut the loop
section and write your own wp_query
.
Welcome to the empowering side of WordPress!
Edit:
This is a modified version of the code you provided. Realize that you should, as @ngsonst suggested, you will want to save this as another file, such as facebook-page.php
. You will then create a new page from the WordPress backend and assign it to this Template, which is named at the top of the file.
<?php
/****
Template Name: Facebook Page
****/
get_header(); ?>
<div class="content-wrap">
<div class="content">
<?php tie_breadcrumbs();
// define parameters for which posts we want
$args = array(
'post_type' => 'post',
'meta_query' => array(
array(
'key' => 'facebook',
'value' => 'yes',
)
)
);
// create new instance of wp_query, the object which loops through posts
$loop = new wp_query($args);
// as long as it has posts, set current post up and do all of the following
while($loop->have_posts()): $loop->the_post();
$get_meta = get_post_custom($post->ID);
//Above Post Banner
if( empty( $get_meta["tie_hide_above"][0] ) ){
if( !empty( $get_meta["tie_banner_above"][0] ) ) echo '<div class="ads-post">' .htmlspecialchars_decode($get_meta["tie_banner_above"][0]) .'</div>';
else tie_banner('banner_above' , '<div class="ads-post">' , '</div>' );
}
?>
<article class="post-listing post">
<?php tie_include( 'post-head' ); // Get Post Head template ?>
<div class="post-inner">
<div class="clear"></div>
<div class="entry">
<?php
// get title as permalink
echo '<h2><a href="'. get_permalink() .'">'. get_the_title() .'</a></h2>';
// get content
the_content();
wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'tie' ), 'after' => '</div>' ) );
edit_post_link( __( 'Edit', 'tie' ), '<span class="edit-link">', '</span>' ); ?>
</div><!-- .entry /-->
</div><!-- .post-inner -->
</article><!-- .post-listing -->
<?php
// end our loop
endwhile;
//Below Post Banner
if( empty( $get_meta["tie_hide_below"][0] ) ){
if( !empty( $get_meta["tie_banner_below"][0] ) ) echo '<div class="ads-post">' .htmlspecialchars_decode($get_meta["tie_banner_below"][0]) .'</div>';
else tie_banner('banner_below' , '<div class="ads-post">' , '</div>' );
}
comments_template( '', true ); ?>
</div><!-- .content -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
Realize that I have no idea what the tie_breadcrumbs
stuff is, and have no way of knowing if it will work with this. You could easily gut all those parts, but wanted to leave that for you to discover. Let us know how this works out.