我正在构建一个 WordPress 网站,当成员添加他们的个人资料时,我希望个人资料直接显示在数据库的主页上。我到目前为止是这样的:
如果有人通过该网站注册,他们的信息将存储在数据库中,他们的个人资料将显示在结果页面中。例如:如果您使用搜索表单并搜索特定成员,它们将显示在:http ://www.website.com/results/URL (其中 results 是始终显示结果的页面。这是我拥有的代码工作得很好:
<style>
.person_name {
font-size:13px; text-align:center; text-transform:uppercase; padding-top:8px;
}
.person_image {
padding:4.2px; border:1px solid #aaa; width:125px;
}
</style>
<?php $state=$_GET['state'];
$county=$_GET['county'];
$city=$_GET['city'];
$zip=$_GET['zip'];
/**/
// Make a MySQL Connection
mysql_connect("localhost", "user", "pass") or die(mysql_error());
mysql_select_db("user") or die(mysql_error());
// Retrieve all the data from the "example" table
$result = mysql_query("SELECT * FROM persons WHERE city='".$city."' OR zip='".$zip."' ORDER BY name")
or die(mysql_error());
while($row = mysql_fetch_array($result)){
echo "<div style='display:inline-block;margin-right:15px;cursor:pointer;' onclick='location=\"http://www.website.com/profile/?id=".str_replace(' ','_',$row["name"])."\"'>";
echo "<div class='person_image'><img src='http://www.website.com/wp-content/uploads/".$row['photo']."' style='' width='125px' /></div>";
echo "<div class='person_name'>".$row['name']."</div>";
echo "</div>";
}
/**/
//echo "page for: ".$state." ".$county." ".$city." ".$zip;
?>
在我的主页上以及我希望在结果页面之外显示数据的位置有点棘手。我希望只能显示 6 个配置文件。我还想提一下,我正在使用帮助我在页面中显示 php 的 Execute PHP 插件。
这是我想在其中显示这些配置文件的一些主页代码:
if ( is_active_sidebar( 'Our Newest Members' ) ) {
echo '<div class="Our Newest Members">';
echo '<h4>' . __( 'Our Newest Members', 'themename' ) . '</h4>';
dynamic_sidebar( 'Our Newest Members' );
echo '</div><!-- end .OurNewestMembers -->';
}
我不是一个精通代码的人,但总是愿意学习,我也非常乐意回答任何后续问题。非常感谢您的所有帮助,这个社区摇滚!!!!
约翰