1435 posts
  • Has referred 200+ members
  • Has sold $40,000+ on Envato Market
  • Has collected 1+ items on Envato Market
  • Member of the Envato Team
+12 more
kailoon Envato team says

I am having problem to display category dropdown in theme option page after upgraded to wp 2.8. Anyone have the same issue? I am try to solve it but seems that there is no changes in wp 2.8 for the related template tags/functions.

Any idea?

238 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 100+ members
  • Has sold $5,000+ on Envato Market
  • Has collected 1+ items on Envato Market
+4 more
Mastergreed says

Funny, I’ve just investigated the matter due to a similar question on polish wordpress support forum. The only thing I have found out that no one really knows what is going on… Weird indeed.

86 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 10+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 50+ items on Envato Market
+2 more
YA says

Kailoon, I had the same problem. I expertimented with the code – but it didn’t work. Btw, the dropdown for pages worked ok. I couldn’t find a solution and made textboxes for users to enter ids of categories.

629 posts
  • Has referred more than 5000 members
  • Has sold $2M+ on Envato Market
  • Has collected 100+ items on Envato Market
  • Had an item featured in a magazine
+9 more
Kriesi says

i am not sure if i got it right, you want to create a custom dropdown that lists all categorys?

if thats the case you can use a snippet i have written for my custom option pages: http://pastie.org/511509

86 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 10+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 50+ items on Envato Market
+2 more
YA says

The issue is populating categories into theme options dropdowns. Here is the code: http://pastie.org/511532 . It works in wp 2.7, but no longer works in wp 2.8.

1599 posts Chris Robinson
  • Located in United States
  • Has sold $500,000+ on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has been part of the Envato Community for over 6 years
+10 more
contempoinc says

Here’s what I’m using in my theme options page, works perfect in 2.8

http://pastie.org/511619

352 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 50+ members
  • Has sold $10,000+ on Envato Market
  • Had an item featured in an Envato Bundle
+6 more
danharper says

I’m having exactly the same problem with my themes!

My Code

352 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 50+ members
  • Has sold $10,000+ on Envato Market
  • Had an item featured in an Envato Bundle
+6 more
danharper says

It seems as though get_categories() can not run correctly inside functions.php

For example, if I place:


<pre><?php print_r(get_categories()); ?></pre>

inside footer.php (or any other template file), the categories are returned correctly.

However, I run the code inside functions.php, and an ‘invalid_taxonomy’ error is output.

Still investigating…

86 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 10+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 50+ items on Envato Market
+2 more
YA says

@danharper It works for me in the functions.php file. The array is populated with categories. But when I pass this array variable to “options” array – it doesn’t work. http://pastie.org/511532

352 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 50+ members
  • Has sold $10,000+ on Envato Market
  • Had an item featured in an Envato Bundle
+6 more
danharper says

Are you sure your $site_cats array is getting populated?

Could you just test this out for me.. Add the following code to the very top of your functions.php file (inside <?php):


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

Then open your WordPress in your browser (either the front site, or dashboard). From the top of the page should be the output of get_categories().

When I do this in WordPress 2.7, categories are returned correctly, like so:


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
        )
....
....
)

But when I do this in 2.8, this is output:


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

        )

    [error_data] => Array
        (
        )

)
by
by
by
by
by
by