رفتن به مطلب

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

سلام

کد زیر کد صفحه اول قالبم هست که برای افزونه edd تنظیم شده است و محصولات دانلودی را نمایش می دهد

مشکل من اینه که همه مطالب اول صفحه قرار میگیرند و نمی دونم چطور و با چه کدی تنظیم کنم که فقط 9 محصول صفحه اول باشند و صفحه گذاری بشه مطالب.

اینم کد صفحه اول


<?php get_header(); ?>
<div id="main-content" class="row store-template">

<?php putRevSlider("slider1","homepage") ?>

<div class="content clearfix">
<?php
$current_page = get_query_var('page');
$per_page = get_option('posts_per_page');
$offset = $current_page > 0 ? $per_page * ($current_page-1) : 0;
$product_args = array(
'post_type' => 'download',
'posts_per_page' => $per_page,
'offset' => $offset
);
$products = new WP_Query($product_args);
?>
<?php if ($products->have_posts()) : $i = 1; ?>
<?php while ($products->have_posts()) : $products->the_post(); ?>
<div class="threecol product<?php if($i % 4 == 0) { echo ' last'; } ?>">
<a href="<?php the_permalink(); ?>">
<h2 class="title"><?php the_title(); ?></h2>
</a>
<div class="product-image">
<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail('product-image'); ?>
</a>
<?php if(function_exists('edd_price')) { ?>
<div class="product-price">
<?php
if(edd_has_variable_prices(get_the_ID())) {
// if the download has variable prices, show the first one as a starting price
echo 'Starting at: '; edd_price(get_the_ID());
} else {
edd_price(get_the_ID());
}
?>
</div><!--end .product-price-->
<?php } ?>
</div>
<?php if(function_exists('edd_price')) { ?>
<div class="product-buttons">
<?php if(!edd_has_variable_prices(get_the_ID())) { ?>
<?php echo edd_get_purchase_link(get_the_ID(), 'Add to Cart', 'button'); ?>
<a href="<?php the_permalink(); ?>">نمایش جزئیات</a>
<?php } ?>

</div><!--end .product-buttons-->
<?php } ?>
</div><!--end .product-->
<?php $i+=1; ?>
<?php endwhile; ?>

<div class="pagination">
<?php
$big = 2; // need an unlikely integer
echo paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, $current_page ),
'total' => $products->max_num_pages
) );
?>
</div>
<?php else : ?>

<h2 class="center">پیدا نشد</h2>
<p class="center">Sorry, but you are looking for something that isn't here.</p>
<?php get_search_form(); ?>

<?php endif; ?>
</div><!--end .content-->
</div><!--end #main-content.row-->
<?php get_footer(); ?>

ادرس سایتم هم این هست اگه لازمه ببینید

http://ketabdaneshju.ir

لینک به ارسال

سلام.

افزونه WP-PageNavi رو نصب و فعال کنید.

وارد تنظیمات وردپرس خودتون بشید > خواندن > بیشترین تعداد نوشته‌ها در هر برگه‌ی وبلاگ = 10

کد زیر رو جایگزین کد خودتون کنید:


<?php get_header(); ?>
<div id="main-content" class="row store-template">
<?php putRevSlider("slider1","homepage") ?>
<div class="content clearfix">
<?php
$current_page = get_query_var('page');
$per_page = get_option('posts_per_page');
$offset = $current_page > 0 ? $per_page * ($current_page-1) : 0;
$product_args = array(
'post_type' => 'download',
'posts_per_page' => $per_page,
'offset' => $offset
);
$products = new WP_Query($product_args);
?>
<?php if ($products->have_posts()) : $i = 1; ?>

<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts(array('paged' => $paged)); while (have_posts()):the_post();?>

<div class="threecol product<?php if($i % 4 == 0) { echo ' last'; } ?>">
<a href="<?php the_permalink(); ?>">
<h2 class="title"><?php the_title(); ?></h2>
</a>
<div class="product-image">
<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail('product-image'); ?>
</a>
<?php if(function_exists('edd_price')) { ?>
<div class="product-price">
<?php
if(edd_has_variable_prices(get_the_ID())) {
// if the download has variable prices, show the first one as a starting price
echo 'Starting at: '; edd_price(get_the_ID());
} else {
edd_price(get_the_ID());
}
?>
</div><!--end .product-price-->
<?php } ?>
</div>
<?php if(function_exists('edd_price')) { ?>
<div class="product-buttons">
<?php if(!edd_has_variable_prices(get_the_ID())) { ?>
<?php echo edd_get_purchase_link(get_the_ID(), 'Add to Cart', 'button'); ?>
<a href="<?php the_permalink(); ?>">نمایش جزئیات</a>
<?php } ?>

</div><!--end .product-buttons-->
<?php } ?>
</div><!--end .product-->
<?php $i+=1; ?>

<?php endwhile;?>
<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); }?>

<div class="pagination">
<?php
$big = 2; // need an unlikely integer
echo paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, $current_page ),
'total' => $products->max_num_pages
) );
?>
</div>
<?php else : ?>

<h2 class="center">پیدا نشد</h2>
<p class="center">Sorry, but you are looking for something that isn't here.</p>
<?php get_search_form(); ?>

<?php endif; ?>
</div><!--end .content-->
</div><!--end #main-content.row-->
<?php get_footer(); ?>

لینک به ارسال

سلام.

افزونه WP-PageNavi رو نصب و فعال کنید.

وارد تنظیمات وردپرس خودتون بشید > خواندن > بیشترین تعداد نوشته‌ها در هر برگه‌ی وبلاگ = 10

کد زیر رو جایگزین کد خودتون کنید:


<?php get_header(); ?>
<div id="main-content" class="row store-template">
<?php putRevSlider("slider1","homepage") ?>
<div class="content clearfix">
<?php
$current_page = get_query_var('page');
$per_page = get_option('posts_per_page');
$offset = $current_page > 0 ? $per_page * ($current_page-1) : 0;
$product_args = array(
'post_type' => 'download',
'posts_per_page' => $per_page,
'offset' => $offset
);
$products = new WP_Query($product_args);
?>
<?php if ($products->have_posts()) : $i = 1; ?>

<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts(array('paged' => $paged)); while (have_posts()):the_post();?>

<div class="threecol product<?php if($i % 4 == 0) { echo ' last'; } ?>">
<a href="<?php the_permalink(); ?>">
<h2 class="title"><?php the_title(); ?></h2>
</a>
<div class="product-image">
<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail('product-image'); ?>
</a>
<?php if(function_exists('edd_price')) { ?>
<div class="product-price">
<?php
if(edd_has_variable_prices(get_the_ID())) {
// if the download has variable prices, show the first one as a starting price
echo 'Starting at: '; edd_price(get_the_ID());
} else {
edd_price(get_the_ID());
}
?>
</div><!--end .product-price-->
<?php } ?>
</div>
<?php if(function_exists('edd_price')) { ?>
<div class="product-buttons">
<?php if(!edd_has_variable_prices(get_the_ID())) { ?>
<?php echo edd_get_purchase_link(get_the_ID(), 'Add to Cart', 'button'); ?>
<a href="<?php the_permalink(); ?>">نمایش جزئیات</a>
<?php } ?>

</div><!--end .product-buttons-->
<?php } ?>
</div><!--end .product-->
<?php $i+=1; ?>

<?php endwhile;?>
<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); }?>

<div class="pagination">
<?php
$big = 2; // need an unlikely integer
echo paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, $current_page ),
'total' => $products->max_num_pages
) );
?>
</div>
<?php else : ?>

<h2 class="center">پیدا نشد</h2>
<p class="center">Sorry, but you are looking for something that isn't here.</p>
<?php get_search_form(); ?>

<?php endif; ?>
</div><!--end .content-->
</div><!--end #main-content.row-->
<?php get_footer(); ?>

اقا با این کد که کل چینش مطالب سایتم بهم ریخت

تازه مطالب ناقص هم لود میشه

این روش فکر نکنم برای edd کاربرد داشته باشه

لطفا دوستان کمک کنند

من خیلی گیر اینم!!

لینک به ارسال

دوستان یعنی تو این اتجمن کسی نیس کمک کنه؟

کسی اینو بلد نیس؟

من یه چیزایی پیدا کردم

ولی نمیفهممش

من از قالب استارتر خود edd استفاده کردم و گسترشش دادم

اینم ادرس خود قالبه که داری صفحه بندی هم هست:

https://easydigitaldownloads.com/starter-theme/

یکیش اینه

https://github.com/pippinsplugins/EDD-Starter-Theme/issues/4

یکی دیگه

https://github.com/pippinsplugins/EDD-Starter-Theme/pull/5

اینم موجوده ولی نمیدونم فرقش چیه و چه چیزی رو تو صفحه بندیش حل کردن:

https://github.com/sumobi/EDD-Starter-Theme/commit/28ccebd4785b5c1c29f93b699bab55cc6af955e0

لینک به ارسال

اینکه بگید کسی بلد/آشنا نیست فقط باعث میشه دیگر جوابی به شما داده نشود

قوانین را بخوانید

لینک به ارسال

اینکه بگید کسی بلد/آشنا نیست فقط باعث میشه دیگر جوابی به شما داده نشود

قوانین را بخوانید

http://forum.wp-pars...دی/#entry116081

ممنون از پاسخ گویی شما

ولی نمی دونم چطور خود به خود درست شد

بازم ممنون

لینک به ارسال

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

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

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

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

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

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

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

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

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