Results 1 to 1 of 1

Thread: Get ad listing ID - Automatic file renaming plugin

  1. #1
    Thread Starter
    Rookie sdurual's Avatar
    Join Date
    Sep 2018
    Posts
    6
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Get ad listing ID - Automatic file renaming plugin

    Hello there,

    I'm trying to custom a plugin to improve SEO of my site. The plugin I want to use is "File renaming on upload" - by Pablo S G Pacheco, which allows automatic renaming of uploaded images.
    So that each time user posts an ad and uploads media file(s), media(s) will be automatically rename with ad title and ad price.
    The problem is I can't get the ad post id I need in the code to make the renaming effective.

    Here's the code I wrote on my child theme functions.php file :

    PHP Code:
    //------------------ FILE RENAMING ON UPLOAD - Add rules


    add_filter'frou_sanitize_file_name', function($filename_infs){
        
        
    $current_post get_the_id();
        
    $filename_infs['structure']['translation']['adprice'] = get_post_meta($current_post)['cp_price'][0];
       
        return 
    $filename_infs;
    }, 
    20 );

    add_filter'frou_sanitize_file_name', function($filename_infs){

        
    $current_post get_the_id();
        
    $filename_infs['structure']['translation']['adtitle'] = str_replace(' ''_'htmlspecialchars(get_the_title($current_post)));

        return 
    $filename_infs;
    }, 
    20 ); 
    Hope I give enought informations to document my issue....
    Could someone help me please ?

    Thanks in advance, I really need this SEO functionality !

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Renaming "(more…)" on the blog? What file is that in?
    By checkit518 in forum Vantage General Discussion (Legacy)
    Replies: 9
    Last Post: May 16th, 2014, 09:22 AM
  2. [SOLVED] Renaming "(more…)" on the blog? What file is that in?
    By checkit518 in forum Help Using Vantage (Legacy)
    Replies: 9
    Last Post: May 16th, 2014, 09:22 AM
  3. How can I edit the automatic emails that go out after listing ads?
    By maryclove in forum Report ClassiPress Bugs
    Replies: 6
    Last Post: June 21st, 2012, 01:34 PM
  4. Automatic Listing of Adverts
    By danjo in forum Report ClassiPress Bugs
    Replies: 1
    Last Post: April 12th, 2011, 01:00 PM