WordPress.org

Ready to get started?Download WordPress

Forums

issues with categories widget (6 posts)

  1. wotto
    Member
    Posted 1 year ago #

    hello, i am having a very confusing problem with the categories widget. I have added some functions to the functions.php file of my theme to handle custom shortcodes. The shortcodes work just fine, however my categories no longer show up in the sidebar. I tried downloading the AVH Categories Widget plugin just to see if that would help but the exact same thing happens. at first i thought it had to do with the theme but the Categories Widget is not a part of my theme so i feel like it has something to do with wordpress itself...? i have been working on this problem for two days and am completely stumped. any help would be greatly appreciated, i can supply with code/additional info if needed but its your standard custom shortcode code, nothing fancy or any tricks, thank you

    P.S. Using WordPress 3.5.1

  2. wotto
    Member
    Posted 1 year ago #

    i think im onto something. while handling the shortcode, i have to connect to an old database (non-WP) to pull the information needed. I think this is causing the problem as WP is looking for categories in a non-WP database. how would i go about reconnecting to my WP database?

  3. David Choi
    Member
    Posted 1 year ago #

    For non-WP db, you can create another instance for that query, so it won't affect default WP db connection

    $non_wp_db = new $wpdb( 'username', 'password', 'db name', 'hostname' );
    $q = $non_wp_db->get_results( 'SELECT * FROM vars' );
    var_dump( $q ); /* do something with the results */
  4. wotto
    Member
    Posted 1 year ago #

    awesome thank you! i will test this out today

  5. wotto
    Member
    Posted 1 year ago #

    worked perfectly, thanks again !

  6. David Choi
    Member
    Posted 1 year ago #

    Glad it worked, have a nice day!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.