Thommy Cesar

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • in reply to: Howto define custom UPLOAD PATH? #397067

    Thommy Cesar
    Expired Member
    Post count: 2

    Hi Stiofan,

    I use a plugin (associated to my theme) in which I make all extensions/adjustments. That’s why it’s in a class.

    Exactly with the code from above it works with other custom post types to change the upload path. How would you do it for geodirectory?

    in reply to: Howto define custom UPLOAD PATH? #396701

    Thommy Cesar
    Expired Member
    Post count: 2

    Hi Stiofan,

    I’ve tried the following, but I can’t get it to work. It’s starting to frustrate me. Could you help me out with the right code, please?

    I want all geodirectory entries to be saved under uploads/places/[year]/[month]/.

    
    
    
    add_filter('upload_dir', array(&$this, 'aa_geodir_ext_custom_gd_place_upload_dir'));
    function aa_geodir_ext_custom_gd_place_upload_dir( $args ) {
           $id = $_REQUEST['post_id'];
           $parent = get_post( $id )->post_parent;
           // Check the post-type of the current post
           if( "gd_place" == get_post_type( $id ) || "gd_place" == get_post_type( $parent ) ) {
              $args['subdir'] = "/places" . '/' . date( 'Y/m' ) . $args['subdir'];
              $args['path'] = $args['basedir'] . $args['subdir'];
              $args['url']  = $args['baseurl'] . $args['subdir'];
              // $args['baseurl']  = $args['baseurl'] . "/places" . '/' . date( 'Y/m' );
           }
           return $args;
        }
    
Viewing 2 posts - 1 through 2 (of 2 total)
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount