plankton 67 Posted January 12, 2015 Report Share Posted January 12, 2015 Здравствуйте, есть шаблон detube 1.47 версия купленный на utema_ru. В single.php нужно выдачу похожих постов на случайные посты изменить. Для это-го нужно в functions.php шаблона, отредактировать/подогнать функцию “dp_related_posts()” на rand/random - случайную выдачу. В single.php не надо нечего редактировать, но я его выложу для ознакомления файла, в самом funtions.php нужно от, отрезка «dp_related_posts()» подогнать функцию выдаче на random/случайную. single: https://yadi.sk/d/BjYQITZfdtvtG funtion: https://yadi.sk/d/G5FIIy9FdtvpA demo: http://themeforest.net/item/detube-professional-video-wordpress-theme/full_screen_preview/2664497 Пишите свой предложения/решения/помощь, а также могу заплать за быстрое и качественной решения задачи. Quote Link to post Share on other sites
Модератор files 2807 Posted January 12, 2015 Модератор Report Share Posted January 12, 2015 Добавьте в array 'orderby' => 'rand', plankton 1 Quote Link to post Share on other sites
plankton 67 Posted January 12, 2015 Author Report Share Posted January 12, 2015 function dp_related_posts($args = '') { global $post; $query_args = array( 'orderby' => 'rand', ); $defaults = array( 'view' => 'grid-mini', 'number' => 0, 'fields' => '' // object, html or leave it blank Пробивал два варианта без результата function dp_related_posts($args = '') { global $post; $query_args = array(); $defaults = array( 'orderby' => 'rand', 'view' => 'grid-mini', 'number' => 0, 'fields' => '' // object, html or leave it blank Quote Link to post Share on other sites
Модератор files 2807 Posted January 12, 2015 Модератор Report Share Posted January 12, 2015 В single.php попробуйте: <?php dp_related_posts(array( 'number'=>get_option('dp_related_posts'), 'orderby' => 'rand', 'view'=>get_option('dp_related_posts_view', 'grid-mini') )); ?> plankton 1 Quote Link to post Share on other sites
plankton 67 Posted January 13, 2015 Author Report Share Posted January 13, 2015 Тему можно закрыть, задача решена. Quote Link to post Share on other sites
murchiktv 191 Posted March 12, 2015 Report Share Posted March 12, 2015 Тему можно закрыть, задача решена. Как решили проблему? Тоже думаю поменять похожие на случайные посты. Quote Link to post Share on other sites
VIP campusboy 912 Posted March 12, 2015 VIP Report Share Posted March 12, 2015 Как решили проблему? Тоже думаю поменять похожие на случайные посты. <ul> <?php $args = array( 'posts_per_page' => 5, 'orderby' => 'rand' ); $rand_posts = get_posts( $args ); foreach( $rand_posts as $post ) : ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endforeach; ?> <?php wp_reset_postdata() ?> </ul> murchiktv 1 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.