Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Installing & running WordPress (http://forum.bytesforall.com/forumdisplay.php?f=6)
-   -   Categories admin page missing (http://forum.bytesforall.com/showthread.php?t=1013)

paulae Mar 30, 2009 06:09 AM

Categories admin page missing
 
This is so odd. For the last few days, my categories page is missing. That is, if I click on Categories under Post, I see a blank page. If I click on Dashboard, then in the Right Now/At a glance box, I click on Categories, they all show up just fine. In fact, nothing appears wrong with anything else, just the categories page when clicked from Categories under Post.

Over at wordpress.org, I found this thread: http://wordpress.org/support/topic/165126?replies=15

It appears that a database table was corrupted for some of these folks. I have tried deactivating several plugins, first the WP-Sticky one mentioned, then the others that I think were installed around the time I noticed the missing categories page. Nothing has helped yet, but I haven't tried repairing the table.

I did let mySQL check wp_posts and it didn't show a problem. Then I did a screen cap of the structure. http://www.larchmontgazette.com/postcat.pdf
Is that how it should look?

And here, it looks like there are no categories for these posts, yet they show up fine on the site.
http://www.larchmontgazette.com/postcat2.pdf

Flynn Mar 30, 2009 06:10 PM

My wp_posts table shows a few more fields like GUID, post_parent, menu_order, post_type, comment_count, in WP 2.7

What I don't have (but you do) is sidebar_title and sidebar_content.

Those look like they don't belong there unless a plugin put them there.

There were 2 more suggestions in that thread, one being to upload a fresh /wp-admin/ directory, the other to repair the table in PhpMyadmin. It looks like the table is kaput

paulae Mar 31, 2009 05:42 AM

Is there any chance that by uploading a clean admin directory, I'll end up losing anything?

Flynn Mar 31, 2009 07:17 AM

No, a new admin directory shouldn't do any harm.

paulae Mar 31, 2009 07:22 AM

I see something in wp-admin called az_sem_cache. I am using AZ Index plugin, so I assume it comes with that. Should I delete the whole directory before uploading the clean one, or just overwrite the old files and let new things like az_sem_cache stay?

paulae Mar 31, 2009 08:10 AM

OK, I re-installed wp-admin, but nothing changed. I still do not see the categories page when I click on Categories, but the site is working fine otherwise.

Flynn, are you interested in some paid trouble-shooting? I doubt this is a theme issue, so I think we should move to a consultancy status.

Flynn Mar 31, 2009 08:06 PM

Thank you for the offer but I can hardly keep up with the things I am currently working on. Have you tried to repair the table? You should probably make a backup first.

paulae Mar 31, 2009 08:10 PM

Understood. Do you think it's the wp_posts table? There doesn't seem to be a wp_categories table.

Should I back up the whole database or just that table?

Flynn Mar 31, 2009 08:38 PM

The wp_posts table looked out of order. Perhaps other tables are damaged too. I'd backup everything and start all over with trying to repair one table after another and installing Wordpress again until everything works. Sounds like a lot of work, unfortunately.

paulae Mar 31, 2009 08:58 PM

I'll see what I can do about it.

How does this kind of thing happen? Did I do something wrong that I can avoid in the future?

Flynn Mar 31, 2009 11:14 PM

Perhaps the server was shut off all of a sudden, I don't know. I don't think that Atahualpa caused this. In the newer Atahualpa versions I am not accessing the database directly, only through standard Wordpress functions.

paulae Apr 1, 2009 05:32 AM

The ISP support guy said they repaired all the tables last night, but the problem persists. I've asked him to go in as admin to see what I mean.

I guess the next step would be to re-install WP and the theme? Would this be a good time to install the new Atahualpa? I had customized the header config file in Functions quite a bit to put a 2-column logo and an ad in the logo area. What will happen to that? I am also using several custom post templates.

Flynn Apr 1, 2009 08:22 AM

I'd install the new version as a new theme and run both side by side. That way you can see whether the issues are related to the a certain version of Atahualpa and also carry over your edits one by one.

paulae Apr 1, 2009 09:47 AM

OK, I did upload new Atahualpa and tried it out. No change with the categories problem.

I just discovered something strange.

In wp-content/plugins, there is a file called categories.php. There is no such file in my source folder on my hard drive. I'll put as much of the contents of the file at the end as the forum allows. It says it replaces the default WP categories widget. I did load several plugins having to do with categories, and deactivated several that didn't help me. When I deleted this categories.php, I got an error message when clicking on Categories in Dashboard, saying "Cannot load categories page."

So I was getting frustrated, but just now, I put the file back and deleted it again, and voila! The categories list appears now! All seems to be working, at least as far as I can tell.

Was this file an artifact left over after I deleted a plugin that didn't help me? I see a bunch of files in /plugins that must be put there by plugins, outside the folders of the individual plugins. I wonder which of them may be causing other troubles? I wish that when you remove a plugin's folder, the artifacts would also get zapped.

I hope this thread is helpful to somebody else at some point. I think I'll point to it from the wordpress.org thread I mentioned earlier. Thanks for the help, Flynn and others!

Now, when I switch to new Atahualpa, I should be OK if I just substitute the theme files I've modified, like the header config which shows my custom ad placement?


[code]<?php

/**
* Advanced categories widget
* Replaces the default WordPress Categories widget
* Arguments are input through the widget control panel
*
* @since 0.1
*/
function widget_reloaded_categories($args, $widget_args = 1) {

extract($args, EXTR_SKIP);

if(is_numeric($widget_args))
$widget_args = array('number' => $widget_args);

$widget_args = wp_parse_args($widget_args, array('number' => -1));

extract($widget_args, EXTR_SKIP);

$options = get_option('widget_reloaded_categories');

if(!isset($options[$number]))
return;

$title = apply_filters('widget_title', $options[$number]['title']);
$orderby = $options[$number]['orderby'];
$order = $options[$number]['order'];
$exclude = $options[$number]['exclude'];
$include = $options[$number]['include'];
$depth = (int)$options[$number]['depth'];
$cat_number = (int)$options[$number]['cat_number'];
$child_of = (int)$options[$number]['child_of'];
$current_category = (int)$options[$number]['current_category'];
$feed_image = $options[$number]['feed_image'];

$hierarchical = $options[$number]['hierarchical'] ? '1' : '0';
$use_desc_for_title = $options[$number]['use_desc_for_title'] ? '1' : '0';
$show_last_updated = $options[$number]['show_last_updated'] ? '1' : '0';
$show_count = $options[$number]['show_count'] ? '1' : '0';
$hide_empty = $options[$number]['hide_empty'] ? '1' : '0';
$feed = $options[$number]['feed'] ? '1' : '0';
if($feed)
$feed = __('RSS','reloaded');

$categories = array(
'exclude' => $exclude,
'include' => $include,
'number' => $cat_number,
'depth' => $depth,
'orderby' => $orderby,
'order' => $order,
'show_last_updated' => $show_last_updated,
'style' => 'list',
'show_count' => $show_count,
'hide_empty' => $hide_empty,
'use_desc_for_title' => $use_desc_for_title,
'child_of' => $child_of,
'feed' => $feed,
'feed_image' => $feed_image,
'hierarchical' => $hierarchical,
'title_li' => false,
'current_category' => $current_category,
'echo' => 0,
'depth' => $depth,
);

echo $before_widget;

if($title)
echo $before_title . $title . $after_title;

echo '<ul class="xoxo categories">';

echo str_replace(array("\r", "\n", "\t"), '', wp_list_categories($categories));

echo '</ul>' . $after_widget;
}

/**
* Widget controls for the categories widget
* Options are chosen from user input from the widget panel
*
* @since 0.1
*/
function widget_reloaded_categories_control($widget_args) {

global $wp_registered_widgets;

static $updated = false;

if(is_numeric($widget_args))
$widget_args = array('number' => $widget_args);

$widget_args = wp_parse_args($widget_args, array('number' => -1));

extract($widget_args, EXTR_SKIP);

$options = get_option('widget_reloaded_categories');

if(!is_array($options))
$options = array();

if(!$updated && !empty($_POST['sidebar'])) :

$sidebar = (string)$_POST['sidebar'];

$sidebars_widgets = wp_get_sidebars_widgets();

if(isset($sidebars_widgets[$sidebar]))
$this_sidebar =& $sidebars_widgets[$sidebar];
else
$this_sidebar = array();

foreach($this_sidebar as $_widget_id) :

if('widget_reloaded_categories' == $wp_registered_widgets[$_widget_id]['callback'] && isset($wp_registered_widgets[$_widget_id]['params'][0]['number'])) :

$widget_number = $wp_registered_widgets[$_widget_id]['params'][0]['number'];

unset($options[$widget_number]);

endif;

endforeach;

foreach((array)$_POST['widget-reloaded-categories'] as $widget_number => $widget_reloaded_categories) :

$use_desc_for_title = strip_tags(stripslashes($widget_reloaded_categorie s['use_desc_for_title']));

$title = strip_tags(stripslashes($widget_reloaded_categorie s['title']));

$exclude = strip_tags(stripslashes($widget_reloaded_categorie s['exclude']));

$include = strip_tags(stripslashes($widget_reloaded_categorie s['include']));

$order = strip_tags(stripslashes($widget_reloaded_categorie s['order']));

$orderby = strip_tags(stripslashes($widget_reloaded_categorie s['orderby']));

$feed = strip_tags(stripslashes($widget_reloaded_categorie s['feed']));

$feed_image = strip_tags(stripslashes($widget_reloaded_categorie s['feed_image']));

$child_of = strip_tags(stripslashes($widget_reloaded_categorie s['child_of']));

$depth = strip_tags(stripslashes($widget_reloaded_categorie s['depth']));

$show_count = strip_tags(stripslashes($widget_reloaded_categorie s['show_count']));

$show_last_updated = strip_tags(stripslashes($widget_reloaded_categorie s['show_last_updated']));

$hide_empty = strip_tags(stripslashes($widget_reloaded_categorie s['hide_empty']));

$cat_number = strip_tags(stripslashes($widget_reloaded_categorie s['cat_number']));

$hierarchical = strip_tags(stripslashes($widget_reloaded_categorie s['hierarchical']));

$current_category = strip_tags(stripslashes($widget_reloaded_categorie s['current_category']));

$options[$widget_number] = compact('title', 'use_desc_for_title', 'exclude', 'include', 'orderby', 'order', 'show_last_updated', 'show_count', 'hide_empty', 'feed', 'feed_image', 'child_of', 'depth', 'cat_number', 'hierarchical', 'current_category');

endforeach;

update_option('widget_reloaded_categories', $options);

$updated = true;

endif;

if($number == -1) :
$title = '';
$exclude = '';
$include = '';
$orderby = '';
$order = '';
$use_desc_for_title = '';
$show_last_updated = '';
$show_count = '';
$hide_empty = '';
$feed = '';
$feed_image = '';
$child_of = '';
$depth = '';
$cat_number = '';
$hierarchical = '';
$current_category = '';
$number = '%i%';
else :
$title = attribute_escape($options[$number]['title']);
$exclude = attribute_escape($options[$number]['exclude']);
$include = attribute_escape($options[$number]['include']);
$orderby = attribute_escape($options[$number]['orderby']);
$order = attribute_escape($options[$number]['order']);
$use_desc_for_title = attribute_escape($options[$number]['use_desc_for_title']);
$show_count = attribute_escape($options[$number]['show_count']);
$show_last_updated = attribute_escape($options[$number]['show_last_updated']);
$hide_empty = attribute_escape($options[$number]['hide_empty']);
$feed = attribute_escape($options[$number]['feed']);
$feed_image = attribute_escape($options[$number]['feed_image']);
$child_of = attribute_escape($options[$number]['child_of']);
$depth = attribute_escape($options[$number]['depth']);
$cat_number = attribute_escape($options[$number]['cat_number']);
$hierarchical = attribute_escape($options[$number]['hierarchical']);
$current_category = attribute_escape($options[$number]['current_category']);
endif;

?>

</code>

Flynn Apr 1, 2009 10:03 AM

Quote:

Originally Posted by paulae (Post 4006)
Now, when I switch to new Atahualpa, I should be OK if I just substitute the theme files I've modified, like the header config which shows my custom ad placement?

Since 3.3. a few bigger changes happened under the hood, so it'd be better if you actually looked inside the files and applied the changes from your old files on the new files.

I.e.

All $bfa_ata_option_name variables are now named $bfa_ata['option_name']

A larger section of code "Figure out sidebars" went from header.php+footer.php (2x) to index.php (1x)

Instead of a "foreach ($options as $value)" loop on top of many files, there's only one in index.php now and all other files get all the options with a simple "global $bfa_ata"

All this improved the speed of Atahualpa by about 100 milliseconds on a fast host. I don't plan to do such a fundamental change anymore.


Good to hear that you got it working now...


All times are GMT -6. The time now is 06:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.