reza98 2 ارسال شده در شهریور 93 گزارش بازنشر ارسال شده در شهریور 93 با سلامطبق این کدی که به درخواست خانم مقبولی در این تاپیک استاد فخار براشون نوشتند میتوان نظرات ارسال کاربر رو در صفحه پروفایلش به نمایش گذاشت.من کد استاد فخار رو تبدیل کردم و باهاش تونستم مطالب ارسالی کاربر رو هم بتونم نمایش بدمکد نمایش نظرات<?phpif(isset($_POST['offset'])) {$offset = $_POST['offset'];}else {$offset = '0';}$next2 = $offset+5;$prev2 = $offset-5;if($prev <0) {$prev = '0';}$curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author));$curauth_id = $user->id;$args = array ('status' => 'approve','type' => 'comment','user_id' => $curauth_id,'number' => '5','offset' => $offset,'order' => 'DESC','orderby' => 'comment_ID',);$comment_query = new WP_Comment_Query;$comments = $comment_query->query( $args );if ( $comments ) {foreach ( $comments as $comment ) {echo get_permalink($comment->comment_post_ID);echo '<br>';echo get_the_title($comment->comment_post_ID);echo '<br>';echo get_the_author($comment->comment_post_ID);echo '<br>';echo $comment->comment_content; echo $comment->comment_date;echo '<br>';}$args = array ('status' => 'approve','type' => 'comment','user_id' => $curauth_id,'number' => '1','offset' => $next,'order' => 'DESC','orderby' => 'comment_ID',);$comment_query = new WP_Comment_Query;$comments = $comment_query->query( $args );if ( $comments ) {?><form style="display:inline" method="post" action=""><input type="hidden" name="offset" value="<?php echo $next2;?>"><input type="submit" value="Next"></form><?php }?><?php if($prev < 0) { ?><form style="display:inline" method="post" action="/"><input type="hidden" name="offset" value="<?php echo $prev2;?>"><input type="submit" value="Prev"></form><?php }}?>کد نمایش مطالب<?phpif(isset($_POST['offset'])) {$offset = $_POST['offset'];}else {$offset = '0';}$next1 = $offset+5;$prev1 = $offset-5;if($prev <0) {$prev = '0';}$args = array ( 'author' => $user->id, // I could also use $user_ID, right? 'orderby' => 'post_date', 'order' => 'ASC');$post_query = new wp_query;$posts = $post_query->query( $args );if ( $posts ) {foreach ( $posts as $post ) {echo get_permalink($post->ID);echo '<br>';echo get_the_title($post->ID);echo '<br>';echo get_the_author($post->ID);echo '<br>';}$args = array ( 'author' => $user->id, // I could also use $user_ID, right? 'orderby' => 'post_date', 'order' => 'ASC' );$post_query = new WP_Query;$posts = $post_query->query( $args );if ( $post ) {?><form style="display:inline" method="post" action=""><input type="hidden" name="offset" value="<?php echo $next1;?>"><input type="submit" value="Next"></form><?php }?><?php if($prev < 0) { ?><form style="display:inline" method="post" action="/"><input type="hidden" name="offset" value="<?php echo $prev1;?>"><input type="submit" value="Prev"></form><?php }}?>کد های بالا 5 تا آخرین مطالب و نظرات نویسندرو نمایش میدنحالا مشکلی که دارم اینه که میخوام با کلیک بر روی دکمه next پنچ تا مطلب بعدی کاربر اگه داشت لود بشهاگه نداشت دکمه next دیگه نمایش داده نشهممنون لینک به ارسال
پست های پیشنهاد شده
لطفا برای ارسال دیدگاه وارد شوید
شما بعد از اینکه وارد حساب کاربری خود شدید می توانید دیدگاهی ارسال کنید
ورود به حساب کاربری