Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/269.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在此页面上实现“加载更多”?_Php_Wordpress - Fatal编程技术网

Php 如何在此页面上实现“加载更多”?

Php 如何在此页面上实现“加载更多”?,php,wordpress,Php,Wordpress,查看此页面: 向下滚动至页面底部,查看最新反馈部分。看看它最终是如何变长的?希望时间会更长 我想要的是显示,比如说,10条反馈,然后让其他人有一个加载更多按钮或类似的东西 以下是与该位相关的php文件中的代码: <div class="box_title_feedbk"><?php echo __("Latest Feedback",'PricerrTheme'); ?></div> <div cl

查看此页面:

向下滚动至页面底部,查看最新反馈部分。看看它最终是如何变长的?希望时间会更长

我想要的是显示,比如说,10条反馈,然后让其他人有一个加载更多按钮或类似的东西

以下是与该位相关的php文件中的代码:

                <div class="box_title_feedbk"><?php echo __("Latest Feedback",'PricerrTheme'); ?></div>
            <div class="box_content_feedcontz">

        <?php



                global $current_user;
                get_currentuserinfo();

                $the_id = get_the_ID();

                $pid = get_the_ID();
                $post = get_post(get_the_ID());
                $uid = $post->post_author;
                $author = get_userdata($uid);

                global $wpdb;
                $query = "select distinct *, ratings.id ratid from ".$wpdb->prefix."job_ratings ratings, ".$wpdb->prefix."job_orders orders, 
                ".$wpdb->prefix."posts posts where posts.ID=orders.pid AND posts.ID='$pid' AND 
                 ratings.awarded='1' AND orders.id=ratings.orderid AND posts.post_author='$uid' order by ratid desc limit 12";
                $r = $wpdb->get_results($query);

                if(count($r) > 0)
                {


                    foreach($r as $row)
                    {
                        $post = $row->pid;
                        $post = get_post($post);
                        $user = get_userdata($row->uid);

                        ?>

                        <div class="post" style="border:0" id="post-<?php echo $row->ratid; ?>">
                            <div class="padd10_only">
                            <div class="image_holder4">
                            <img width="25" height="25" border="0" src="<?php echo pricerrTheme_get_avatar($row->uid,25,25); ?>" />
                            </div>

                        <div class="title_holder4" >
                        <h2><a href="<?php echo get_bloginfo('siteurl'); ?>/user-profile/<?php echo $user->user_login; ?>"><?php echo $user->user_login; ?></a> 
                        <span class="rating-beeing-done"><?php

                        $xx = current_time('timestamp',0) - $row->datemade;
                        $xx = PricerrTheme_prepare_seconds_to_words($xx);


                                echo sprintf(__("wrote %s ago",'PricerrTheme'), $xx); 



                         ?></span></h2>



                        <div class="c111"><p><?php

                        if($row->grade == 1) echo '<img style="float:left" src="'.get_bloginfo('template_url').'/images/thup.png" border="0" /> &nbsp;';
                        if($row->grade == 0) echo '<img style="float:left" src="'.get_bloginfo('template_url').'/images/thdown.jpg" border="0" /> &nbsp;';

                        ?>
                        <?php echo stripslashes($row->reason); ?></p>
                        </div>


                        </div> 



                        </div>
                        </div>


                        <?php

                    }

                }
                else
                {
                    _e("The service doesn't have feedback yet.","PricerrTheme");    
                }
            ?>


        </div>
所以我需要在那里实现这个功能。我想这应该不难做到,但我不确定


希望有人能帮忙。谢谢。

您有几个选择:

您可以限制对要显示的前X个条目的查询,使用“加载更多”链接,然后加载下一个分页步骤或显示“全部”

隐藏除第一个X查询外的所有查询,然后使用JS函数操纵DOM以显示其余查询

利用WP-RESTAPI作为服务,使用一些JS/AJAX函数来控制和显示项目

你的问题的答案确实比设计的要复杂得多。这个答案应该能帮你找到正确的方向,这样你就能学到你需要的东西