Support » Fixing WordPress » Category template tags

  • I’m trying to add a category template tag to show a dropdown menu on one of my pages (I’m using execphp to run php inside posts/pages) It works fine when I just use this code

    <?php wp_dropdown_categories(); ?>

    But when I add either $args to the parameters or the following code to functions.php wordpress returns nothing and I just get a blank page.

    <?php $args = array(
        'show_option_all'    => ,
        'show_option_none'   => ,
        'orderby'            => 'ID',
        'order'              => 'ASC',
        'show_last_update'   => 0,
        'show_count'         => 0,
        'hide_empty'         => 1,
        'child_of'           => 0,
        'exclude'            => ,
        'echo'               => 1,
        'selected'           => 0,
        'hierarchical'       => 0,
        'name'               => 'cat',
        'id'                 => ,
        'class'              => 'postform',
        'depth'              => 0,
        'tab_index'          => 0,
        'taxonomy'           => 'category',
        'hide_if_empty'      => false ); ?>

    I have to go into my ftp client and delete the code from the page in notepad in order to do anything inside wordpress. Does anyone know why this happens?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Adding the $args to functions.php could be causing conflicts with other functions that make use of $args? Or (and apologies if you have only done this for the purpose of posting in the forum), it may be that you have a PHP error because you have the open and close PHP tags in before and after your code – functions.php would have them at the start and end of the file.

    I’m thinking it’s because $args is conflicting with some other code in wordpress.. But right now I’m just trying to get wordpress to opne up again. Everything in my wordpress site is just a blank page right now :S

    Sounds like fun!

    What $args have you changed from the defaults then (or are all of the ones listed above different)? These are the only ones that need pssing and can by done by using a string. Here is an example –

    <?php wp_dropdown_categories('hide_if_empty=1&id=cat-list'); ?>

    I figured it out. It was definitely a php conflict. I had to delete the functions.php file and create a new one, as well as go inside myphpadmin and delete all the rows inside the wp-post table with the variable causing the conflict in them.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Category template tags’ is closed to new replies.