Image uploader inside custom post widget
-
I’v built a custom widget that will show some sport scores. Scores are added trough custom post. When i open new custom post(scores) i enter their team names, score, scores. Now i want to add an option to show team logos next to the team name. In the last couple of days every tutorial here and elsewhere i could find didnt worked. I have no idea why, as i am newbie with all this. With many of it, upload button appears but the pop up to chose/upload image doesnt appear. Now I could post at least 10 links where i found this codes but i believe there is a limit with link. So for an example this is most common tutorial i have found.
[Large code excerpt removed by moderator per forum rules. Please use the pastebin for all large code excerpts. It works better anyway.]
what exactly is this ‘my_plugin_page’ i guess i am doing something wrong and that’s why uploader doesnt pop up. What i need to add instead of it, any example?
Inside my theme i’v made a new folder called my-plugin inside which i added my-admin.js with the script code from the link above. Is this the right way?
I also tried other way without it and calling the script by get_template_directory_uri().
Any help pls.
-
This is a pastebin url with the code i am trying to use
Sorry, but I’m having trouble figuring out what you mean when you say:
I’v built a custom widget that will show some sport scores. Scores are added trough custom post. When i open new custom post(scores) i enter their team names, score, scores.
So you want to add an image in the widget or in a post? If you are using a widget, why not just use a plugin like – https://wordpress.org/plugins/black-studio-tinymce-widget/
it has a media file uploader in there already.Hi Cristine,
So you want to add an image in the widget or in a post?
I want to add image in my situation small logos inside custom post, and those images (logos) will be shown on the frontend of widget.
Now i have a normal widget (i registered custom posts inside function.php and i added score.php widget) and a plugin (mix of previously explained two). With both way i cant figure it out which uploder doesnt pop up.
So let me explain, i registered custom posts called score. Inside those custom posts i have fields to enter stuff like team name, team 1 score, team 2 score. There i want to add team logos (images) as well and that’s why i am seeking for – image upload option.
So inside custom score post i would call twice logos for both teams. And i tried many codes, button shows up, but it doesnt offer image uploder. Like it doesnt work.
This is my code of the plugin
And again the code with which i am trying to solve this
I think i tried every solution i could found, but no luck.
Just starting to learn wordpress.
Kind regards, any help really appreciated
i have problem with this
Hi Bruler, what problem do you have?
Ok, I managed to get it working, but now the issue is, it doesnt save it. So what now?
The topic ‘Image uploader inside custom post widget’ is closed to new replies.