Forums

[resolved] Multiple posts with category=blog don't show up on a single page (3 posts)

  1. PDouglas
    Member
    Posted 1 year ago #

    I'm a bit green and have inherited something that I'm having trouble figuring out.

    When I started on it, /blog mapped to a page, rather than posts. That page came up from the navBar and from the url /blog. The only category for posts was "uncategorized." No theme was activated, but a custom theme was present. Whoever did the initial work used tables within the pages to show both the text and some images (that could have been in a side bar.)

    I changed the name of the page and its permalink so that it wouldn't be confused with posts. I created a category called Blog with a slug called blog. I then assigned an existing post to the category blog and created a test post that I assigned to the category blog. In Settings and Writing, I set the default post category to "Blog." In Settings and Reading, the front page displays a static page "home." The drop down for posts is set to "- select -," even though I'm not sure that matters. Blog pages show at most 10 posts. For each article in a feed show "full text." I also activated the custom theme, but it didn't seem to change anything on the pages. In hindsight, perhaps I shouldn't have done that.

    Tried changing the NavBar Link
    The link on the navBar points to /blogs. When you click it, the first post comes up. There's a link to the second post. The url /category/blog brings up a page with both of the posts.

    In an effort to show some progress, even if it is a bit ugly, I thought that I would point the navBar link to /category/blog. So I FTPed the files from the site down to my desktop and opened NetBeans so I could find the navBar in every file. I found and changed the link in 3 files: wp-content/themes/theme_name/blog.php, ../home.php, ../page.php.

    Well, daggone, when I open my browser, the navBar link still points to /blog. I've cleared the cache in my browser. I don't see any caching plugins in the WordPress installation. Only two plugins are activated: Google Analytics for WordPress & WP-ContactForm: Akismet Edition. I have since checked the links on the server. They all point to /category/blog. I even went into the file manager in cPanel to make sure that the links truly had been changed.

    checked "The Loop"
    I thought I would go back to figuring out the underlying problem. I found /wp-content/theme/theme_name/blog.php, .../home.php, .../index.php, .../page.php. They all have at a minimum

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    		<?php the_content(); ?>
    	<?php endwhile; endif; ?>

    The way I read that is that PHP will go through each post and print the content. So that the /blog page should contain the content for the each of the two posts

    I thought that perhaps I needed more in .../blog.php, so I copied this from another file:

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    		<?php /*the_content(); */?>
    
    <!-- starts the copied in content -->
    		<div class="post">
    				<h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
    				<small><?php the_time('l, F jS, Y') ?></small>
    
    				<div class="entry">
    					<?php the_content() ?>
    				</div>
    
    				<p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?>  <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
    
    			</div>
    
    <!-- ends the copied in content -->
    
    	<?php endwhile; endif; ?>

    It makes more sense in color with longer lines. Once again, clicking the /blog link brings you to the content for the first post.

    mySQL wp_posts table
    So I thought that I would check the database to make sure that the blogs posts were supposed to be showing up as /blog. I found the database name and location in wp-config.php in the root. I checked the wp_posts table. It has 10 pages of records that look like the info on the web site. The last two changes (modifying the first post and my test post) aren't in it! I did a "order by" on the post_date filed. My recent post isn't there. I did an "order by" on the post_modified. The first post (or at least the recent modification) isn't there. I thought that something must be wrong so I exported the data into Excel and did sorts in Excel. Same results. It's had plenty of time to write the records to the database. Those two new posts have to be coming from somewhere?????

    footer.php
    Another odd thing: I thought I would do some troubleshooting with queries and defined constants. I added some lines to /wp-content/themes/them_name/footer.php. Here's the contents of the file:

    <!--Not getting other errors.  Lines in wp-config.php will trap queries.  The lines below will print them.-->
    
    <?php
    
        global $wpdb;
        echo "<pre>";
        print_r($wpdb->queries);
        echo "</pre>";
    <br/>
    print_r(@get_defined_constants());
    print "something";
    
    ?>Something
    <center>
    <div id="footerContent">
    Copyright © 2010 xxxxxxxxxx</a></div>
    </center>
    
    <?php wp_footer(); ?>
    </body>
    </html>

    I added this line to wp-config.php

    define('SAVEQUERIES', true);

    Nothing prints from these lines. The contents of the footer match with what I see in the browser. I took the if statement off the queries. Even this line doesn't do anything!

    print "something";

    I can think of only two other things that could be an underlying issues:
    1) this site's folder is contained inside the folder for another site. For example, I can access the site by its normal url or by folder_name/other_sites_name.com
    2) the theme isn't widget-aware.

    Can someone help me?
    Thank you!
    Pat

  2. PDouglas
    Member
    Posted 1 year ago #

    Update
    My error logs started working!

    I found an issue with the plugin "WP-ContactForm: Akismet Edition" so I disabled that. I found some query issues, so I took the line
    define('SAVEQUERIES', true); out of wp-config.php. I took the query statement and a php cofig issue out of footer.php. It now looks like

    <!--Not getting other erros.  Lines in wp-config.php will trap queries.  The lines below will print them.-->
    
    <?php
    print "something";
    
    ?>
    Something
    <center>
    <div id="footerContent">
    Copyright © 2010 XXXXXX</a></div>
    </center>
    
    <?php wp_footer(); ?>
    </body>
    </html>

    Of the remaining errors

    1. One error tells me that /wp-includes/cron.php is timing out on line 60.
    2. Another error is "get_settings is deprecated since version 0.0! Use get_option() instead. in /XXXXX/wp-includes/functions.php on line 2970"
    3. Still another error is "PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20060613/ffmpeg.so' - libavformat.so.51: cannot open shared object file: No such file or directory in Unknown on line 0
      "

    All this with no change to how the page displays. /category/blog is the only way I can get to the page with multiple blog posts. The navBar still refers to /blog and it goes to first post. "Something" is supposed to print twice before the footer, but it doesn't. Any suggestions? Am I going nuts? Is the WordPress installation corrupt? Declare failure and start over?

    Thanks
    Pat

  3. PDouglas
    Member
    Posted 1 year ago #

    Never mind. It turns out that the site is hosted somewhere else. No wonder I had so many problems!

Topic Closed

This topic has been closed to new replies.

About this Topic