WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [Theme Epsilon] 2.8 upgrade messed up Categories (35 posts)

  1. CD7
    Member
    Posted 5 years ago #

    Hey

    My theme does not recognize the categories after upgrade to 2.8 anymore. I'm using the epslon Theme and it has a config file, where you need to choose the category for special posts, but they aint showing up anymore there.

    Does anyone know how wp has changed dealing with categories and what could it be that I need to change?

    E!

  2. MichaelH
    Member
    Posted 5 years ago #

    That theme uses a number of different plugins--do any of those need upgrading?

    2.8 doesn't really do anything different with categories.

  3. CD7
    Member
    Posted 5 years ago #

    I have upgraded all of them. I'm not using most of them anyways.

  4. MichaelH
    Member
    Posted 5 years ago #

    I think your categories are okay--looks to be something in that theme's controlpanel.php (Epsilon Theme Options). Maybe the author has an update.

  5. eight7teen
    Member
    Posted 5 years ago #

    So you're a moderator and you still haven't figured out that there are thousands of people out there who are having this exact same problem? haha

    There seems to be an issue with the get_categories() function being called/used inside the theme's functions.php file for every single theme I've tried so far.

    Call me crazy, but I'm not thinking that it's a theme developer issue...

    Just my 2ยข

  6. MichaelH
    Member
    Posted 5 years ago #

    The get_categories works fine for me.

    Using the WordPress Default theme, in wp-content/themes/default/index.php put this right before the if (have_posts()) line:

    <?php
    $categories = get_categories('hide_empty=0');
    foreach ($categories as $cat) {
    	echo '<p> Cat name: ' . $cat->cat_name .'<p>';
    }
    ?>

    Do you get a list of your categories when you visit your blog?

  7. MichaelH
    Member
    Posted 5 years ago #

    eight7teen--what theme are you using?

  8. eight7teen
    Member
    Posted 5 years ago #

    Our Magazine by Kailoon

  9. MichaelH
    Member
    Posted 5 years ago #

    Our Magazine by Kailoon looks to be a theme you purchase. Get the author to fix it.

  10. eight7teen
    Member
    Posted 5 years ago #

    WOW! Gee I hadn't thought of that... Oh wait, yes I did. The problem is that the author can't figure out why her code that has worked perfectly in other versions of WP doesn't work in this version.

    I'm loving the support chain here. It seems to follow a pattern:

    1. Problem reported
    2. Moderator replies asking for details
    3. Details given
    4. Moderator points to theme author
    5. End user left in dark

    That's a definite recipe for success right there.

  11. webdemar
    Member
    Posted 5 years ago #

    eight7teen is right. It's not a problem of the theme!

    The problem appears when you use get_categories in the funtions.php (as well in the default theme).

    Have the same problem.

  12. MichaelH
    Member
    Posted 5 years ago #

    Sorry if it looks like I'm running you around.

    I don't think it's the get_categories in the theme's functions.php

    I put this in the wp-content/theme/default/functions.php

    function my_list_cats() {
    $cats_array = get_categories('hide_empty=0');
    $categories = array();
    
    foreach ($cats_array as $cats) {
    	$categories[$cats->cat_ID] = $cats->cat_name;
    	echo '<p> Cat name: ' . $cats->cat_name .'<p>';
    
    }
    echo "<pre>"; print_r($categories); echo "</pre>";
    }

    and this in wp-content/themes/default/index.php:

    <?php
    my_list_cats();
    ?>

    and it displayed the categories.

    Using the Epsilon theme I also changed all the occurences of get_settings with get_option to no avail.

  13. danharper
    Member
    Posted 5 years ago #

    Michael, I posted this just in another thread, so sorry for double-posting:

    This is definitely either an undocumented feature change or a bug in WP 2.8 as the get_categories() function can not retrieve any categories when used inside functions.php - anywhere on the front-end is fine.

    To test this, include the following code to the very top of a functions.php file:

    echo '<pre>';
    print_r(get_categories('hide_empty=0'));
    echo '</pre>';

    Now, as you know, this should print out an array containing all categories on the site.
    Try this on 2.7.1 and all other older versions, the code works correctly by printing out:

    Array
    (
        [0] => stdClass Object
            (
                [term_id] => 3
                [name] => Tutorials
                [slug] => tutorials
                [term_group] => 0
                [term_taxonomy_id] => 3
                [taxonomy] => category
                [description] =>
                [parent] => 0
                [count] => 5
                [cat_ID] => 3
                [category_count] => 5
                [category_description] =>
                [cat_name] => Tutorials
                [category_nicename] => tutorials
                [category_parent] => 0
            )
    ....
    ....
    )

    However in 2.8, the following is output:

    Array
    (
        [errors] => Array
            (
                [invalid_taxonomy] => Array
                    (
                        [0] => Invalid Taxonomy
                    )
    
            )
    
        [error_data] => Array
            (
            )
    
    )

    As I stated, the code works fine in front-end files, but not in the back-end.

    This is not a problem with a theme or plugin error, as exactly the same problem is seen if you add the code to the default WordPress themes.

  14. MichaelH
    Member
    Posted 5 years ago #

    danharper - see my example right before your post.
    http://wordpress.org/support/topic/280256?replies=13#post-1104250

  15. danharper
    Member
    Posted 5 years ago #

    Michael, in your example, you are creating a function in functions.php which calls get_categories(), but you use that function in a front-end file.

    Our problem is that get_categories() does not work when used solely in the back-end - ie. we're creating a options page for our theme which requires a list of the categories.

    Try out my example, and you'll see it does not work.

  16. eight7teen
    Member
    Posted 5 years ago #

    danharper - I've come to accept that it's useless to try to get him to see reason... Or any of them for that matter... I've done some digging, and I finally came up with a tangible result in the Trac... It seems as though they're completely dismissing the issue there as well..

    http://core.trac.wordpress.org/ticket/9644

    Edit: I retract that... They've finally seen reason. It just took them a while.

  17. danharper
    Member
    Posted 5 years ago #

    Also, I've tried this on a fresh install of 2.8, no plugins installed, and using the default theme.

  18. MichaelH
    Member
    Posted 5 years ago #

    Ah, I see that now. Placing this echo "<pre>"; print_r($zm_categories_obj); echo "</pre>"; after this $zm_categories_obj = get_categories('hide_empty=0'); in the Epsilon theme's controlpanel.php returns the 'error data' you described.

  19. MichaelH
    Member
    Posted 5 years ago #

    I reopened Trac Ticket 9644.

  20. danharper
    Member
    Posted 5 years ago #

    Thank-you Michael.

  21. eight7teen
    Member
    Posted 5 years ago #

    Yes, muchas gracias Michael

  22. MichaelH
    Member
    Posted 5 years ago #

    And thank you for your patience.

  23. jujuwiwi
    Member
    Posted 5 years ago #

    Cool You've got the same problem, I'm not alone !!!!!

    I use the theme Scarlett. One of the feature is to choose a category from the admin panel to display a photo gallery.

    Now I can't choose any more after upgrading to 2.8 from 2.7.1

    $zm_categories_obj = get_categories('hide_empty=0');
    $zm_categories = array();
    foreach ($zm_categories_obj as $zm_cat) {
    	$zm_categories[$zm_cat->cat_ID] = $zm_cat->cat_name;

    This code is from controlpanel.php and it's load by functions.php like this:
    require_once(TEMPLATEPATH . '/controlpanel.php');

    For the moment I need to replace the variable by the value in controlpanel.php code... I hope a solution.

    If think we are really a lot to encounter this problem.

  24. eight7teen
    Member
    Posted 5 years ago #

    well, looks like I'm gonna need to regress back to 2.7.1 until they release a bug patch for this one...

  25. jujuwiwi
    Member
    Posted 5 years ago #

    @eight7teen
    you don't need to downgrade to 2.7.1. Until a patch for this, you can populate your array yourself in functions.php or controlpanel.php

    $zm_categories_obj = get_categories('hide_empty=0');
    $zm_categories = array();
    foreach ($zm_categories_obj as $zm_cat) {
    	$zm_categories[$zm_cat->cat_ID] = $zm_cat->cat_name;

    instead I've got this now:

    $zm_categories = array();
    $zm_categories[0] = "Photos";
    $zm_categories[1] = "WordPress";

    ...

    You have to replace "Photos" and "WordPress" by the name of your categories. After that you can select the category in the theme control panel like before...

  26. Ryan Boren
    WordPress Dev
    Posted 5 years ago #

    The latest 2.8.1 nightly build has a fix for this if anyone wants to try it out:

    http://wordpress.org/nightly-builds/wordpress-2.8-latest.zip

    You can do an automatic upgrade by going into wp-includes/version.php and changing $wp_version from 2.8 to 2.8.1-beta and then visiting Tools->Upgrade.

  27. jujuwiwi
    Member
    Posted 5 years ago #

    Thank you so much !!!

  28. aesop1
    Member
    Posted 5 years ago #

    Awesome. Quick turnaround.

  29. CD7
    Member
    Posted 5 years ago #

    Yay works, thank you very much ;) All of you ;)

  30. danharper
    Member
    Posted 5 years ago #

    Thanks for the quick response :)

Topic Closed

This topic has been closed to new replies.

About this Topic