Forum Replies Created

Viewing 15 replies - 1 through 15 (of 17 total)
  • Thread Starter idlee69

    (@idlee69)

    Interesting! 80% zoom works for me, must be a bug with the browsers then. Not sure how you get flexboxes in WordPress, it seems to reconfigure an image with caption from between <caption> tags to <figure> tags when the page is processed for online.

    Thread Starter idlee69

    (@idlee69)

    Thanks for looking and sending your screen shot. I have tried it in FFox, Chrome and Edge and the 4th one always goes in the centre of the next line by itself, then the next 3 in the line below. Similar all over my website. https://www.fdahs.org.uk/temp/screen.jpg
    What browser were you using?

    Thread Starter idlee69

    (@idlee69)

    There is no mention in the log file of the page that has been edited and the page remains listed in the cache contents.

    Thread Starter idlee69

    (@idlee69)

    It appears that the filenames giving the problem are stored as part of an array with the label ‘url’. Can this be allowed for in your plugin?

    Here is part of an export from the database:
    meta_id;”post_id”;”meta_key”;”meta_value”
    74045;”4609″;”pages_poster_button_url”;”a:2:{s:2:””id””;s:4:””6084″”;s:3:””url””;s:92:””https://localhost/faringdondramatic.org.uk/wp-content/uploads/farndale-avenue-2018-poster.pdf”&#8221;;}”

    Thread Starter idlee69

    (@idlee69)

    I don’t know. My knowledge is not that deep into wordpress. All I can say is that the file paths are not being updated in the database when they are moved in the media management.

    Thread Starter idlee69

    (@idlee69)

    The folders are not the problem, it’s the database not updating with the new path even when these images are moved in media. The files do move physically but the meta in the database is not updated.

    Thread Starter idlee69

    (@idlee69)

    This seems to have now been fixed. Thank you.

    Thread Starter idlee69

    (@idlee69)

    Any response on this? It seems a simple matter to search the database more thoroughly. I had the same issue with the plugin ‘WP Media folders’ by Damien Barrère and he fixed it very quickly. This plugin looks better as it is easier to use without getting the overburdened package ‘WP Media folder’ that is needed to link with it for easier use.

    Thread Starter idlee69

    (@idlee69)

    I have found a way to add a taxonomy or category as a folder list to the media edit screen so you can create and select folders by ticking boxes rather than entering folder changes manually into an input box. It works perfectly except for one little hitch – you have to update the media item twice! First to get the taxonomy folder list changes updated so then they can be used by the plugin to do its stuff. My skills in WordPress have now reached there limit. Any ideas?

    The following changes were made in plugins\wp-media-folders\classes\classes\wp-media-folders.php Line 140-173 are replaced with:
    /**
    * ###############################################################################
    * Add hierarchical taxonomy called ‘Folders’ to ‘Media’ menu
    * https://code.tutsplus.com/articles/applying-categories-tags-and-custom-taxonomies-to-media-attachments–wp-32319
    * register new taxonomy which applies to attachments
    */

    function wptp_add_folders_taxonomy() {
    $labels = array(
    ‘name’ => ‘Folders’,
    ‘singular_name’ => ‘Folder’,
    ‘search_items’ => ‘Search Folders’,
    ‘all_items’ => ‘All Folders’,
    ‘parent_item’ => ‘Parent Folder’,
    ‘parent_item_colon’ => ‘Parent Folder:’,
    ‘edit_item’ => ‘Edit Folder’,
    ‘update_item’ => ‘Update Folder’,
    ‘add_new_item’ => ‘Add New Folder’,
    ‘new_item_name’ => ‘New Folder Name’,
    ‘menu_name’ => ‘Folders’,
    );

    $args = array(
    ‘labels’ => $labels,
    ‘hierarchical’ => true,
    ‘query_var’ => ‘true’,
    ‘rewrite’ => ‘true’,
    ‘show_admin_column’ => ‘true’,
    );

    register_taxonomy( ‘folders’, ‘attachment’, $args );
    }
    add_action( ‘init’, ‘wptp_add_folders_taxonomy’ );

    /**
    * Change file path using the taxonomy of folders.
    * BUT this requires pressing [Update] twice as have to save taxonomy/folder changes first.
    */
    add_filter(
    ‘attachment_fields_to_edit’,
    function ($form_fields, $post) {
    $url = wp_get_attachment_url($post->ID);
    $uploads = wp_upload_dir();
    if (strpos($url, $uploads[‘baseurl’])!==0) {
    $html = __(‘This file is not in the allowed upload folder’, ‘wp-media-folders’);
    } else {
    $path = str_replace($uploads[‘baseurl’], “”, $url);
    $file_extension = pathinfo($path, PATHINFO_EXTENSION);
    $path = ‘/’.$post->post_name;
    $folders_array = wp_get_post_terms($post->ID, ‘folders’, array(‘orderby’ => ‘parent’, “fields” => “names”));
    if (!empty($folders_array)) {$path = ‘/’.strtolower(implode(“/”,$folders_array)).$path;}
    //$html = ‘<span style=”width:80%;” name=”attachments[‘.$post->ID.’][file_path]” id=”attachments[‘.$post->ID.’][file_path]” value=”‘.htmlentities($path).'”>’.htmlentities($path).'</span>’.’.’.$file_extension;
    $html = ‘<input style=”width:80%;” name=”attachments[‘.$post->ID.’][file_path]” id=”attachments[‘.$post->ID.’][file_path]” value=”‘.htmlentities($path).'” /> . ‘.$file_extension;
    }

    $form_fields[‘file_path’] = array(
    ‘label’ => __(‘File path’, ‘wp-media-folders’),
    ‘input’ => ‘html’,
    ‘html’ => $html,
    ‘helps’ => __(sprintf(‘File path and name related to upload folder %s’, ‘/’ . substr($uploads[‘basedir’], strlen(get_home_path()))), ‘wp-media-folders’)
    );

    return $form_fields;
    },
    10,
    2
    );
    /**
    * #####################################################################
    */

    Thread Starter idlee69

    (@idlee69)

    Just letting you know that I have given up with this. Also, I foolishly purchased the WP Media Folder plugin you recommended and have now removed it – partly because half of it does not work with Firefox but mainly because so much of the extras it provides like watermarking and thumbnail regeneration, etc. can be far better done and controlled using other small plugins. The ability to mimic folders is really no better than a simple plugin to provide categories. If only you could lift some open-source category code for your plugin you would have a brilliant self-contained utility well worth paying for. Please let me know if you ever change your mind.

    Thread Starter idlee69

    (@idlee69)

    /uploads/adobe.gif
    /uploads/agatha-crusty-2016-photo-1.jpg
    /uploads/acrobat-sml.gif
    These are images from the page-contents moved to their new folders but got the folder name inserted twice in the new path in the database, eg. /uploads/general/general/adobe.gif
    These 2 from my custom fields worked ok, moved and renamed in database correctly:
    /uploads/agatha-crusty-2016-folly.jpg
    /uploads/agatha-crusty-2016-noda.pdf

    Thread Starter idlee69

    (@idlee69)

    Have done the log file, it seems to be very repetitive and nowhere does it show any duplicated foldernames in the paths. It only shows the two files I moved that went wrong in their meta paths – these where images from a main page contents. Two Files in my own custom fields that I moved (my original problem) have moved perfectly ok.
    The log file is at https://www.faringdondramatic.org.uk/temp/debug.txt

    Thread Starter idlee69

    (@idlee69)

    The double folder pathname issue is back or never went away. It seems it might be just gif files affected. It may be more than this as I first spent hours removing other plugins and reloading my database over and over again while trying to work out what was going wrong.

    Thread Starter idlee69

    (@idlee69)

    Could creating categories to match new folders actually within your plugin as a part of your plugin perhaps be a better way than inserting/typing in a folder name for each and every file?

    Thread Starter idlee69

    (@idlee69)

    That’s working now. Brilliant. Thanks.
    Now if you could link it to the Enhanced Media Library media categories rather than having to type in a folder name for every single media item one at a time (a bit ridiculous really) then this becomes an excellent self-contained plugin.

Viewing 15 replies - 1 through 15 (of 17 total)