WordPress.org

Ready to get started?Download WordPress

Forums

Category template tags (5 posts)

  1. bluedrag
    Member
    Posted 3 years ago #

    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?

  2. David Gard
    Member
    Posted 3 years ago #

    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.

  3. bluedrag
    Member
    Posted 3 years ago #

    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

  4. David Gard
    Member
    Posted 3 years ago #

    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'); ?>

  5. bluedrag
    Member
    Posted 3 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.