Posts Loop Returning Same Post
-
So I am doing a friend’s website and I made the site completely from scratch….I am including the the beginning and end of the loop and am kind of a newb at this so not sure what I’m doing wrong but no matter I do the loop keeps returning the same post…I’ve tried changing the location of wp_reset_query and tried many different query types.
Here is a copy of my code: (functions.php)
ob_start(); error_reporting(0); define('WP_USE_THEMES', false); require('wordpress/wp-blog-header.php'); function curPageURL() { $pageURL = 'http'; if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";} $pageURL .= "://"; if ($_SERVER["SERVER_PORT"] != "80") { $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; } else { $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; } return $pageURL; } function mainMenu(){ $indexpage="index.php"; if((!$_GET['page'])) {echo "<li><a href=\"index.php\" rel=\"home\" class=\"current\">home</a> <li><a href=\"index.php?page=philosophy\">philosophy</a></li> <li><a href=\"index.php?page=objects\">objects.mobiles</a></li> <li><a href=\"index.php?page=mobiles\">children's mobiles</a></li> <li><a href=\"index.php?page=orderinformation\">ordering information</a></li> <li><a href=\"index.php?page=contactme\">contact me</a></li>";} $pagename=$_GET['page']; if(($pagename==philosophy)){ echo "<li><a href=\"index.php\" rel=\"home\" >home</a> <li><a href=\"index.php?page=philosophy\" class=\"current\">philosophy</a></li> <li><a href=\"index.php?page=objects\">objects.mobiles</a></li> <li><a href=\"index.php?page=mobiles\">children's mobiles</a></li> <li><a href=\"index.php?page=orderinformation\">ordering information</a></li> <li><a href=\"index.php?page=contactme\">contact me</a></li>"; } $pagename=$_GET['page']; if(($pagename==objects)){ echo "<li><a href=\"index.php\" rel=\"home\" >home</a> <li><a href=\"index.php?page=philosophy\">philosophy</a></li> <li><a href=\"index.php?page=objects\" class=\"current\">objects.mobiles</a></li> <li><a href=\"index.php?page=mobiles\">children's mobiles</a></li> <li><a href=\"index.php?page=orderinformation\">ordering information</a></li> <li><a href=\"index.php?page=contactme\">contact me</a></li>"; } $pagename=$_GET['page']; if(($pagename==mobiles)){ echo "<li><a href=\"index.php\" rel=\"home\" >home</a> <li><a href=\"index.php?page=philosophy\">philosophy</a></li> <li><a href=\"index.php?page=objects\" >objects.mobiles</a></li> <li><a href=\"index.php?page=mobiles\" class=\"current\">children's mobiles</a></li> <li><a href=\"index.php?page=orderinformation\">ordering information</a></li> <li><a href=\"index.php?page=contactme\">contact me</a></li>"; } $pagename=$_GET['page']; if(($pagename==orderinformation)){ echo "<li><a href=\"index.php\" rel=\"home\" >home</a> <li><a href=\"index.php?page=philosophy\">philosophy</a></li> <li><a href=\"index.php?page=objects\">objects.mobiles</a></li> <li><a href=\"index.php?page=mobiles\">children's mobiles</a></li> <li><a href=\"index.php?page=orderinformation\" class=\"current\">ordering information</a></li> <li><a href=\"index.php?page=contactme\">contact me</a></li>"; } $pagename=$_GET['page']; if(($pagename==contactme)){ echo "<li><a href=\"index.php\" rel=\"home\" >home</a> <li><a href=\"index.php?page=philosophy\">philosophy</a></li> <li><a href=\"index.php?page=objects\" >objects.mobiles</a></li> <li><a href=\"index.php?page=mobiles\">children's mobiles</a></li> <li><a href=\"index.php?page=orderinformation\">ordering information</a></li> <li><a href=\"index.php?page=contactme\" class=\"current\">contact me</a></li>"; } } function wordPressContent(){ if((!$_GET['page'])){wp_reset_query(); query_posts( array ( 'category_name' => 'welcome', 'posts_per_page' => 1 ) ); echo '<div id="content">'; echo '<h1>'; echo the_title(); echo '</h1>'; echo the_content(); echo '</div>';wp_reset_query();} $pagename=$_GET['page']; if(($pagename==philosophy)){wp_reset_query(); query_posts( array ( 'category_name' => 'about' ) ); echo '<div id="content">'; echo '<h1>'; echo the_title(); echo '</h1>'; echo the_content(); echo '</div>'; }} wp_reset_query(); ?>Here is a copy of my code from my index.php file….
<?php require('functions.php'); ?> <!DOCTYPE html> <html lang="en" class="no-js"> <head> <script type="text/javascript" src="modernizr-1.7.min.js"></script> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <?php DynamicMeta();?> <link rel="stylesheet" media="screen and (max-width: 950px)" href="css/small.css" /> <link rel="stylesheet" media="screen and (min-width: 960px)" href="css/style.css" /> <link rel="stylesheet" media="handheld" href="css/mobile.css" type="text/css"> </head> <body> <div id="wrapper"> <header> <a href="index.php" rel="home"><canvas id="logo"> <hgroup> <h1>Noah Crowe</h1> <h2>Artist of Objects, Mobiles, Children's Mobiles, Video Editing</h2></hgroup> </canvas></a> <nav> <h1 id="nav">Noah Crowe:Main Naviation</h1> <ul> <?php curPageURL();mainMenu();?> </ul> </nav> </header> <section> <?php wordPressContent();?> </section> </div> </body> </html> <?php ob_end_flush();?>Thanks, in advance, for any help
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
The topic ‘Posts Loop Returning Same Post’ is closed to new replies.