• Hi,
    I’ve done some tricks with wordpress’s core and now i need a final edit on the media-template.php. But the content of the file seems to be in a language other than just php or javascript. It looks like data model. I want to edit a variable named {{ data.size.url }} but i have no idea where to start.

    Can anyone explain how to edit this file?

    Any clue is appreciated.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    I’ve done some tricks with wordpress’s core

    Do not edit core files.

    Where is this variable? In what file (please give the full path).

    Thread Starter Jack Johansson

    (@mhmdshv)

    Hi steve,

    the file is located in wp-include\media-template.php
    It the data views thumbnail URLs of media upload in the admin panel (only grid view).

    Well i wouldn’t modify core if developers would consider some hooks in thumbnail generation.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    That’s a core file. DO NOT EDIT IT. If you feel the need to edit a core file, you are approaching the problem incorrectly.

    What are you trying to accomplish?

    Thread Starter Jack Johansson

    (@mhmdshv)

    I was trying to change thumbnails generation directory and structure, which has no hook, as far as i know.

    Thread Starter Jack Johansson

    (@mhmdshv)

    Can you please tell me how to work with that file? i would be grateful.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    You said you’re trying to change “thumbnails generation directory and structure.” What problem are you trying to solve?

    Thread Starter Jack Johansson

    (@mhmdshv)

    My problem is, this value {{ data.size.url }} still returns old thumbnail path. I just want to know how can i replace the path with new path, since str_replace() didn’t work. Can you please tell me what language is this template written in? except php.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    It appears to be creating javascript.

    What problem are you trying to solve? You consistently avoid answering that.

    Thread Starter Jack Johansson

    (@mhmdshv)

    Mr. steve i answered that a lot of time. I changed thumbnails name and directory as i wanted, but now, the ONLY problem is : i can’t see my image’s preview in media library (only when viewing in grid mode), because the images still are using the old directory structure and name, and it will return a 404 error.

    For example, the image link should be like this :

    <img src="https://sample.com/thumbs/sample_small.jpg">

    but it is:

    <img src="https://sample.com/wp-content/uploads/sample_small.jpg">

    which {{ data.size.url }} controls the https://sample.com/wp-content/uploads/sample_small.jpg link.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Why *should* it be like that? What do you gain by jumping through all those hoops?

    In any case, I see no point in continuing this. I’m unsubscribing to the thread.

    Thread Starter Jack Johansson

    (@mhmdshv)

    I don’t know why everyone is interested in whether it should or it should not, rather than discussing the technical problem. anyway thanks for the time.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Editing media-template.php in appropriate way’ is closed to new replies.