WordPress Wysiwyg Content not being displayed

My WordPress website really isn’t working to how I want?!

It was working fine, with nothing being touched, Then lately I find every-page is displaying the same content on each page. Not the individual content that is in the wysiwyg editor.

This is doing my head in, I have a modified theme in which I have already replaced with the original theme files, page.php, index.php and single.php to see if it is a problem with them pages. But it is not!?

The link is http://www.alleanza.co.uk and I was suppose to hand it over last weds and I still can’t because no content is being pulled through. Does anyone have any ideas that may help?

However I have noticed that it is pulling information from the Hello World Post instead of the page’s wysiwyg content.

However, here is the content for page.php

<?php
/*
Template Name: Normal Template
*/
?>

<?php get_header(); ?>

    <div id="content">
    <div id="greybread"><?php if (function_exists('dimox_breadcrumbs')) dimox_breadcrumbs(); ?></div>

<div <?php post_class(); ?> id="post-<?php the_ID(); ?>">

                <?php while ( have_posts() ) : the_post(); ?>

                    <?php the_content(); ?>

                    <?php comments_template( '', true ); ?>

                <?php endwhile; // end of the loop. ?>


    <?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
    </div></div>

<?php get_sidebar(); ?>

<?php get_footer(); ?>

1 Answer
1

To expand on what @fischi said, first step to troubleshooting is switch to the default theme (twentyeleven) and disable all plugins. If your content shows up, turn plugins back on one by one until you either find the offending plugin or they’re all on. If you get them all back on and the content still shows, you know the problem is somewhere in your theme.

To generate a list of theme files used for any page, put this code at the end of your functions.php:

// Returns a list of files used to generate the page.  Best called in footer.php before </body>
function get_template_name () {
    echo '<pre>';
    foreach ( debug_backtrace() as $called_file ) {
        print_r($called_file['file']);
        echo '<hr />';
    }
    echo '</pre>';
}

This will output a list of all php files used to generate a page, and you can easily see which template files are being called (look for \wp-content\themes\mytheme\something.php).

Edited to add: You will need to call this function somewhere. I prefer to include it in footer.php, right before </body> like this:

<?php
if (is_user_logged_in()) {
    get_template_name() ;
}
?>

You can also add this line after the function in functions.php: add_action('wp_footer', 'get_template_name'); but that will generate it for everyone, not just the logged in user. You can also use is_admin() instead of is_user_logged_in() if you want to restrict it even further.

Leave a Comment