رفتن به مطلب

رفع مشکل دسته در این کد


پست های پیشنهاد شده

با سلام کد زیر را میخام فقط مطالب دسته 2 را نمایش بده ولی این تمام مطالب سایت را نمایش میده چکار کنمش؟


<?php
/*
Template Name: news
*/
?>
<?php get_header(); ?>
<?php
$args = array(
'posts_per_page' => 5,
);

if ( $paged > 1 ) {
$args['paged'] = $paged;
}

$my_query = new WP_Query($args); ?>

<?php if ( $my_query->have_posts() ) : ?>
<?php while ( $my_query->have_posts() ) :
$my_query->the_post(); ?>
<?php
//necessary to show the tags
global $wp_query;
$wp_query->in_the_loop = true;
?>
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>

<div class="entry">
<?php the_content('Read the rest of this entry »'); ?>
</div>

<p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
</div>

<?php endwhile; ?>

<?php else : ?>

<h2 class="center">Not Found</h2>
<p class="center">Sorry, but you are looking for something that isn't here.</p>
<?php get_search_form(); ?>

<?php endif; ?>

<div class="navigation">
<div class="alignleft"><?php
if ( !$max_page ) {
$max_page = $my_query->max_num_pages;
}

if ( !$paged ) {
$paged = 1;
}
$nextpage = intval($paged) + 1;

if ( !is_single() && ( empty($paged) || $nextpage <= $max_page) ) {
$attr = apply_filters( 'next_posts_link_attributes', '' );
echo '<a href="' . next_posts( $max_page, false ) . "\" $attr>". preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', '« Older Entries') .'</a>';
}
?></div>
<div class="alignright"><?php
if ( !is_single() && $paged > 1 ) {
$attr = apply_filters( 'previous_posts_link_attributes', '' );
echo '<a href="' . previous_posts( false ) . "\" $attr>". preg_replace( '/&([^#])(?![a-z]{1,8};)/', '&$1', 'Newer Entries »' ) .'</a>';
}
?></div>
</div>

<?php get_sidebar(); ?>
<?php get_footer(); ?>

لینک به ارسال

تست کنید :

<?php
/*
Template Name: news
*/
?>
<?php get_header(); ?>
<?php
$args = array(
'posts_per_page' => 5,
);

if ( $paged > 1 ) {
$args['paged'] = $paged;
}

$my_query = new WP_Query("showposts=15&cat=3,6"); ?>

<?php if ( $my_query->have_posts() ) : ?>
<?php while ( $my_query->have_posts() ) :
$my_query->the_post(); ?>
<?php
//necessary to show the tags
global $wp_query;
$wp_query->in_the_loop = true;
?>
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>

<div class="entry">
<?php the_content('Read the rest of this entry »'); ?>
</div>

<p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
</div>

<?php endwhile; ?>

<?php else : ?>

<h2 class="center">Not Found</h2>
<p class="center">Sorry, but you are looking for something that isn't here.</p>
<?php get_search_form(); ?>

<?php endif; ?>

<div class="navigation">
<div class="alignleft"><?php
if ( !$max_page ) {
$max_page = $my_query->max_num_pages;
}

if ( !$paged ) {
$paged = 1;
}
$nextpage = intval($paged) + 1;

if ( !is_single() && ( empty($paged) || $nextpage <= $max_page) ) {
$attr = apply_filters( 'next_posts_link_attributes', '' );
echo '<a href="' . next_posts( $max_page, false ) . "\" $attr>". preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', '« Older Entries') .'</a>';
}
?></div>
<div class="alignright"><?php
if ( !is_single() && $paged > 1 ) {
$attr = apply_filters( 'previous_posts_link_attributes', '' );
echo '<a href="' . previous_posts( false ) . "\" $attr>". preg_replace( '/&([^#])(?![a-z]{1,8};)/', '&$1', 'Newer Entries »' ) .'</a>';
}
?></div>
</div>

<?php get_sidebar(); ?>
<?php get_footer(); ?>

توی کد زیر :

cat=3,6

عدد 3 و 6 آیدی دسته هستن ؛ شما میتونید آیدی دسته هایی که میخواهید نشون داده بشه رو بزارید.

لینک به ارسال

تست کنید :

<?php
/*
Template Name: news
*/
?>
<?php get_header(); ?>
<?php
$args = array(
'posts_per_page' => 5,
);

if ( $paged > 1 ) {
$args['paged'] = $paged;
}

$my_query = new WP_Query("showposts=15&cat=3,6"); ?>

<?php if ( $my_query->have_posts() ) : ?>
<?php while ( $my_query->have_posts() ) :
$my_query->the_post(); ?>
<?php
//necessary to show the tags
global $wp_query;
$wp_query->in_the_loop = true;
?>
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>

<div class="entry">
<?php the_content('Read the rest of this entry »'); ?>
</div>

<p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
</div>

<?php endwhile; ?>

<?php else : ?>

<h2 class="center">Not Found</h2>
<p class="center">Sorry, but you are looking for something that isn't here.</p>
<?php get_search_form(); ?>

<?php endif; ?>

<div class="navigation">
<div class="alignleft"><?php
if ( !$max_page ) {
$max_page = $my_query->max_num_pages;
}

if ( !$paged ) {
$paged = 1;
}
$nextpage = intval($paged) + 1;

if ( !is_single() && ( empty($paged) || $nextpage <= $max_page) ) {
$attr = apply_filters( 'next_posts_link_attributes', '' );
echo '<a href="' . next_posts( $max_page, false ) . "\" $attr>". preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', '« Older Entries') .'</a>';
}
?></div>
<div class="alignright"><?php
if ( !is_single() && $paged > 1 ) {
$attr = apply_filters( 'previous_posts_link_attributes', '' );
echo '<a href="' . previous_posts( false ) . "\" $attr>". preg_replace( '/&([^#])(?![a-z]{1,8};)/', '&$1', 'Newer Entries »' ) .'</a>';
}
?></div>
</div>

<?php get_sidebar(); ?>
<?php get_footer(); ?>

توی کد زیر :

cat=3,6

عدد 3 و 6 آیدی دسته هستن ؛ شما میتونید آیدی دسته هایی که میخواهید نشون داده بشه رو بزارید.

تست کردم ولی navigation کار نمیکنه

یعنی میره صفحه بعد ولی همین مطالب صفحه اول را نشان میده

مثلا: میره صفحه 2 ولی مطالب همان مطالب قبلی هست و مطالب بعدی را نمایش نمیده

لینک به ارسال

لطفا اسپم نکنید.

مطمئن باشید اگه کسی بدونه کمک میکنه.

تست کنید:


<?php
/*
Template Name: news
*/
?>
<?php get_header(); ?>
<?php
$args = array(
'posts_per_page'  => 5,
'cat' => 3,6
);

if ( $paged > 1 ) {
  $args['paged'] = $paged;
}

$my_query = new WP_Query($args); ?>

<?php if ( $my_query->have_posts() ) : ?>
  <?php while ( $my_query->have_posts() ) :
  $my_query->the_post(); ?>
                <?php
                //necessary to show the tags
                global $wp_query;
                $wp_query->in_the_loop = true;
                ?>
                <div <?php post_class() ?> id="post-<?php the_ID(); ?>">
                  <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
                  <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>

                  <div class="entry">
                                <?php the_content('Read the rest of this entry »'); ?>
                  </div>

                  <p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?>  <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
                </div>

  <?php endwhile; ?>
 
<?php else : ?>

  <h2 class="center">Not Found</h2>
  <p class="center">Sorry, but you are looking for something that isn't here.</p>
  <?php get_search_form(); ?>

<?php endif; ?>

<div class="navigation">
  <div class="alignleft"><?php
if ( !$max_page ) {
  $max_page = $my_query->max_num_pages;
}

if ( !$paged ) {
  $paged = 1;
}
$nextpage = intval($paged) + 1;

if ( !is_single() && ( empty($paged) || $nextpage <= $max_page) ) {
  $attr = apply_filters( 'next_posts_link_attributes', '' );
  echo '<a href="' . next_posts( $max_page, false ) . "\" $attr>". preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', '« Older Entries') .'</a>';
}
?></div>
  <div class="alignright"><?php
if ( !is_single() && $paged > 1 ) {
  $attr = apply_filters( 'previous_posts_link_attributes', '' );
  echo '<a href="' . previous_posts( false ) . "\" $attr>". preg_replace( '/&([^#])(?![a-z]{1,8};)/', '&$1', 'Newer Entries »' ) .'</a>';
}
?></div>
</div>

<?php get_sidebar(); ?>
<?php get_footer(); ?>

لینک به ارسال

لطفا اسپم نکنید.

مطمئن باشید اگه کسی بدونه کمک میکنه.

تست کنید:


<?php
/*
Template Name: news
*/
?>
<?php get_header(); ?>
<?php
$args = array(
'posts_per_page' => 5,
'cat' => 3,6
);

if ( $paged > 1 ) {
$args['paged'] = $paged;
}

$my_query = new WP_Query($args); ?>

<?php if ( $my_query->have_posts() ) : ?>
<?php while ( $my_query->have_posts() ) :
$my_query->the_post(); ?>
<?php
//necessary to show the tags
global $wp_query;
$wp_query->in_the_loop = true;
?>
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>

<div class="entry">
<?php the_content('Read the rest of this entry »'); ?>
</div>

<p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
</div>

<?php endwhile; ?>

<?php else : ?>

<h2 class="center">Not Found</h2>
<p class="center">Sorry, but you are looking for something that isn't here.</p>
<?php get_search_form(); ?>

<?php endif; ?>

<div class="navigation">
<div class="alignleft"><?php
if ( !$max_page ) {
$max_page = $my_query->max_num_pages;
}

if ( !$paged ) {
$paged = 1;
}
$nextpage = intval($paged) + 1;

if ( !is_single() && ( empty($paged) || $nextpage <= $max_page) ) {
$attr = apply_filters( 'next_posts_link_attributes', '' );
echo '<a href="' . next_posts( $max_page, false ) . "\" $attr>". preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', '« Older Entries') .'</a>';
}
?></div>
<div class="alignright"><?php
if ( !is_single() && $paged > 1 ) {
$attr = apply_filters( 'previous_posts_link_attributes', '' );
echo '<a href="' . previous_posts( false ) . "\" $attr>". preg_replace( '/&([^#])(?![a-z]{1,8};)/', '&$1', 'Newer Entries »' ) .'</a>';
}
?></div>
</div>

<?php get_sidebar(); ?>
<?php get_footer(); ?>

انجام دادم ولی ایندفعه not found داد

کد زیر را پیدا کردم صفحه بندیش درسته فقط تنها مشکلی که دارم اینه که کد زیر تمام نوشته های سایت را قرار میده و نمیتونم کاریش کنم که فقط دسته خاص یا همون cat=1 را نشون بده چطوری میتونم این کارا کنم؟


<?php
/*
Template Name: news
*/
?>
<?php get_header(); ?>
<?php
$args = array(
'posts_per_page' => 5,
'cat' => 3,6
);
if ( $paged > 1 ) {
$args['paged'] = $paged;
}
$my_query = new WP_Query($args); ?>
<?php if ( $my_query->have_posts() ) : ?>
<?php while ( $my_query->have_posts() ) :
$my_query->the_post(); ?>
<?php
//necessary to show the tags
global $wp_query;
$wp_query->in_the_loop = true;
?>
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
<div class="entry">
<?php the_content('Read the rest of this entry »'); ?>
</div>
<p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
</div>
<?php endwhile; ?>

<?php else : ?>
<h2 class="center">Not Found</h2>
<p class="center">Sorry, but you are looking for something that isn't here.</p>
<?php get_search_form(); ?>
<?php endif; ?>
<div class="navigation">
<div class="alignleft"><?php
if ( !$max_page ) {
$max_page = $my_query->max_num_pages;
}
if ( !$paged ) {
$paged = 1;
}
$nextpage = intval($paged) + 1;
if ( !is_single() && ( empty($paged) || $nextpage <= $max_page) ) {
$attr = apply_filters( 'next_posts_link_attributes', '' );
echo '<a href="' . next_posts( $max_page, false ) . "\" $attr>". preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', '« Older Entries') .'</a>';
}
?></div>
<div class="alignright"><?php
if ( !is_single() && $paged > 1 ) {
$attr = apply_filters( 'previous_posts_link_attributes', '' );
echo '<a href="' . previous_posts( false ) . "\" $attr>". preg_replace( '/&([^#])(?![a-z]{1,8};)/', '&$1', 'Newer Entries »' ) .'</a>';
}
?></div>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

لینک به ارسال

انجام دادم ولی ایندفعه not found داد

کد زیر را پیدا کردم صفحه بندیش درسته فقط تنها مشکلی که دارم اینه که کد زیر تمام نوشته های سایت را قرار میده و نمیتونم کاریش کنم که فقط دسته خاص یا همون cat=1 را نشون بده چطوری میتونم این کارا کنم؟


<?php
/*
Template Name: news
*/
?>
<?php get_header(); ?>
<?php
$args = array(
'posts_per_page' => 5,
'cat' => 3,6
);
if ( $paged > 1 ) {
$args['paged'] = $paged;
}
$my_query = new WP_Query($args); ?>
<?php if ( $my_query->have_posts() ) : ?>
<?php while ( $my_query->have_posts() ) :
$my_query->the_post(); ?>
<?php
//necessary to show the tags
global $wp_query;
$wp_query->in_the_loop = true;
?>
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
<div class="entry">
<?php the_content('Read the rest of this entry »'); ?>
</div>
<p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
</div>
<?php endwhile; ?>

<?php else : ?>
<h2 class="center">Not Found</h2>
<p class="center">Sorry, but you are looking for something that isn't here.</p>
<?php get_search_form(); ?>
<?php endif; ?>
<div class="navigation">
<div class="alignleft"><?php
if ( !$max_page ) {
$max_page = $my_query->max_num_pages;
}
if ( !$paged ) {
$paged = 1;
}
$nextpage = intval($paged) + 1;
if ( !is_single() && ( empty($paged) || $nextpage <= $max_page) ) {
$attr = apply_filters( 'next_posts_link_attributes', '' );
echo '<a href="' . next_posts( $max_page, false ) . "\" $attr>". preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', '« Older Entries') .'</a>';
}
?></div>
<div class="alignright"><?php
if ( !is_single() && $paged > 1 ) {
$attr = apply_filters( 'previous_posts_link_attributes', '' );
echo '<a href="' . previous_posts( false ) . "\" $attr>". preg_replace( '/&([^#])(?![a-z]{1,8};)/', '&$1', 'Newer Entries »' ) .'</a>';
}
?></div>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

ببخشید کد اینه :


<?php
/*
Template Name: news
*/
?>
<?php get_header(); ?>
<?php
// the query to set the posts per page to 3
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array('posts_per_page' => 3, 'paged' => $paged );
query_posts($args); ?>
<!-- the loop -->
<?php if ( have_posts() ) : while (have_posts()) : the_post(); ?>
<!-- rest of the loop -->
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
<div class="entry">
<?php the_content('Read the rest of this entry »'); ?>
</div>
<p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
</div>

<?php endwhile; ?>
<!-- pagination -->
<?php next_posts_link(); ?>
<?php previous_posts_link(); ?>
<?php else : ?>
<!-- No posts found -->
<?php endif; ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

لینک به ارسال

تست:


<?php
/*
Template Name: news
*/
?>
<?php get_header(); ?>
<?php
// the query to set the posts per page to 3
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(posts_per_page=3&paged=$paged&cat=1);
query_posts($args); ?>
<!-- the loop -->
<?php if ( have_posts() ) : while (have_posts()) : the_post(); ?>
  <!-- rest of the loop -->
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
                                  <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
                                  <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
                                  <div class="entry">
                                                                <?php the_content('Read the rest of this entry »'); ?>
                                  </div>
                                  <p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?>  <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
                                </div>
                         
<?php endwhile; ?>
<!-- pagination -->
<?php next_posts_link(); ?>
<?php previous_posts_link(); ?>
<?php else : ?>
<!-- No posts found -->
<?php endif; ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

به جای 1 ای دی دسته مورد نظر

کد قبلی هم‌درست بود ولی چون در دسته 3و6 مطلبی وجود نداره میگه not found

لینک به ارسال

تست:


<?php
/*
Template Name: news
*/
?>
<?php get_header(); ?>
<?php
// the query to set the posts per page to 3
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(posts_per_page=3&paged=$paged&cat=1);
query_posts($args); ?>
<!-- the loop -->
<?php if ( have_posts() ) : while (have_posts()) : the_post(); ?>
<!-- rest of the loop -->
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
<div class="entry">
<?php the_content('Read the rest of this entry »'); ?>
</div>
<p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
</div>

<?php endwhile; ?>
<!-- pagination -->
<?php next_posts_link(); ?>
<?php previous_posts_link(); ?>
<?php else : ?>
<!-- No posts found -->
<?php endif; ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

به جای 1 ای دی دسته مورد نظر

کد قبلی هم‌درست بود ولی چون در دسته 3و6 مطلبی وجود نداره میگه not found

عزیز کد قبلی را آی دی دسته ام را گذاشتم ولی ارور not found داد.

کد جدید هم دریم ویر لاین 10 را خطا میگیره

لینک به ارسال

تست:


<?php
/*
Template Name: news
*/
?>
<?php get_header(); ?>
<?php
// the query to set the posts per page to 3
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array('posts_per_page' => 3, 'paged' => $paged, 'cat' => 10 );
query_posts($args); ?>
<!-- the loop -->
<?php if ( have_posts() ) : while (have_posts()) : the_post(); ?>
  <!-- rest of the loop -->
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
                                  <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
                                  <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
                                  <div class="entry">
                                                                <?php the_content('Read the rest of this entry »'); ?>
                                  </div>
                                  <p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?>  <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
                                </div>
                         
<?php endwhile; ?>
<!-- pagination -->
<?php next_posts_link(); ?>
<?php previous_posts_link(); ?>
<?php else : ?>
<!-- No posts found -->
<?php endif; ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

لینک به ارسال

تست:


<?php
/*
Template Name: news
*/
?>
<?php get_header(); ?>
<?php
// the query to set the posts per page to 3
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array('posts_per_page' => 3, 'paged' => $paged, 'cat' => 10 );
query_posts($args); ?>
<!-- the loop -->
<?php if ( have_posts() ) : while (have_posts()) : the_post(); ?>
<!-- rest of the loop -->
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
<div class="entry">
<?php the_content('Read the rest of this entry »'); ?>
</div>
<p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
</div>

<?php endwhile; ?>
<!-- pagination -->
<?php next_posts_link(); ?>
<?php previous_posts_link(); ?>
<?php else : ?>
<!-- No posts found -->
<?php endif; ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

یک دنیا ممنونتم

اینقدر گشتم و گشتم ولی پیدا نکردم واقعا دستت درد نکنه حیف که یکبار تشکر داره وگر نه بیشتر لایک میکردم:)

لینک به ارسال

<?php
/*
Template Name: news
*/
get_header();
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array('posts_per_page' => 3, 'paged' => $paged );
query_posts($args); $recent = new WP_Query("cat=آی دی دسته");if($recent->have_posts()) : while($recent->have_posts()) : $recent->the_post();?>
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
<div class="entry">
<?php the_content('Read the rest of this entry »'); ?>
</div>
<p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
</div>

<?php endwhile; ?>
<?php next_posts_link(); ?>
<?php previous_posts_link(); ?>
<?php else : ?>
<?php endif; ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

لینک به ارسال

به گفتگو بپیوندید

هم اکنون می توانید مطلب خود را ارسال نمایید و بعداً ثبت نام کنید. اگر حساب کاربری دارید، برای ارسال با حساب کاربری خود اکنون وارد شوید .

مهمان
ارسال پاسخ به این موضوع ...

×   شما در حال چسباندن محتوایی با قالب بندی هستید.   حذف قالب بندی

  تنها استفاده از 75 اموجی مجاز می باشد.

×   لینک شما به صورت اتوماتیک جای گذاری شد.   نمایش به صورت لینک

×   محتوای قبلی شما بازگردانی شد.   پاک کردن محتوای ویرایشگر

×   شما مستقیما نمی توانید تصویر خود را قرار دهید. یا آن را اینجا بارگذاری کنید یا از یک URL قرار دهید.

×
×
  • اضافه کردن...