chz516
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: Text Domain and TranslationsI am so unbelievably confused by this.
If my plugin name, in the top of my PHP file is:
My Very First PluginI must make my text domain, used in every _e() and __() call:
my-very-first-pluginAs in:
echo 'untranslated text and ' . __('translated text', 'my-very-first-plugin')
If that is correct I will be sure to do that but, to be honest, I have no idea what this means. I will be doing it so that, when I finally make sense out of this, it will be in place properly.
Switched user names as you can see ??
Forum: Developing with WordPress
In reply to: Text Domain and TranslationsOk, I seem to remember reading that it was sort of open, that others could create translations at will. But I must have mis-read. I guess they need to add the PO files to SVN, so it makes sense the the plugin creator has control.
As for the text domain, I guess what i dont understand is how it looks for the translations:
The text domain is used so the PHP parser knows where to look to find the translations.
So it isnt looking in a subdirectory of the plugin, then. Say the textdomain=”myplugin” what does the parser do with that info?
Forum: Developing with WordPress
In reply to: Text Domain and TranslationsIm still a little confused, but I will do some trial and error with Poedit to try and figure it out. Thanks for the help.
Also, I seem to remember, in my researching, that sometimes others create the translation files for a site, theme, or plugin. Is that the way it works? Others do it as it is needed? Or as the plugin developer, do you create all of the translations you want available?
Oh and other question. I still dont understand text domain. Does the word domain have anything to do with a domain as it is used in the web? I dont think so. But can anyone explain how text domain factors into this, and how it is used? I just dont get its function.
Forum: Developing with WordPress
In reply to: Text Domain and TranslationsIm sorry but this still doesnt make any sense to me.
Here are some specific questions from your answer:“WordPress itself provides translations for its own things” What are its own things?
“your theme could provide translations, each of your plugins could provide translations” How?
“you need to generate a PO file that contains the translatable strings and your translators will use that to create a MO file that PHP can read” What is in the PO file? Each string and its translation?
I guess just looking at the editor you linked to will answer some (maybe all) of these questions. So thank you for the link. I will check it out.
Forum: Fixing WordPress
In reply to: Element Disappears on the Widget Options PageOk, problem solved. I am just hoping someone can confirm if my solution is acceptable or if it may cause other issues.
I simply took the js script that sets up these elements and, instead of using “enqueue_scipts” within “admin_enqueue_scripts”, I just put my script in the function form section with:
<script src="jsfile.js"></script>
With a few changes to that script it works fine.
But is it ok to load a script like this in the admin page?
Forum: Fixing WordPress
In reply to: Element Disappears on the Widget Options PageHmmmm. It appears that hitting the enter key while in a textbox submits the form.
The elements that are disappearing are loaded via js when the page is loaded. So it seems this is wiping them out.
Is there a way to load elements after the form has been loaded, not when the page loads? This way, the elements would be loaded again on each form load.
I have tried $(document).ready and that does not seem to do it. I assume if I put the form name instead of document it may work. But WP creates the form and it has no name or id (which seems strange)
Forum: Fixing WordPress
In reply to: Element Disappears on the Widget Options PageHow can I get a look at exactly what happens when the enter key is pressed inside of a textbox?
Forum: Fixing WordPress
In reply to: Element Disappears on the Widget Options PageNormally, I can save the page as HTML and take it offline. this way I can eliminate code and scripts until I find the one with the issue.
But in this case, for some reason, the behavior doesnt happen when I run locally–which is strange because the page still links to the same js and css.Forum: Fixing WordPress
In reply to: Element Disappears on the Widget Options Pageok, youll have to excuse my lack of knowledge here. I a new to PHP but have been able to do what I needed by finding example and working through them.
But Im not sure what you mean. Ill try to give more info and hopefully I will answer your question.
Im on the page: https://www.mysite.com/wordpress/wp-admin/widgets.php
I have created a plugin/widget and as part of it, there are options the user can select–so I think, yes, it is controlling a specific plugin–the one I have created.
As part of creating the widget options there is the “function form” In this function, I build the various textboxes and dropdowns. It is here where i also have a dropdown for a colorpicker and that is what is disappearing.
I have made sure the class names are unique.
The best I can tell is that when the blue highlght disappears (like the one around this textarea I am typing in now)it takes my dropdown with it.
Forum: Fixing WordPress
In reply to: Does javascript work fully in Widget Option area?Oh I think I was trying $this.id.
Ok, so one more thing. In my plugin file I have enqueued js and css files. But they dont seem to be available to the widget option area, only to the deployed widget on the WP content page.
What is the best way to use js and css in the widget option area. As of now, I am just echoing at the start of my function form:
echo <script>js functions</script> echo <style>css</style>
It works, Im just wondering if that is best practice.
Forum: Fixing WordPress
In reply to: Does javascript work fully in Widget Option area?It seems my widget code exists twice on the widget admin page. Once under “Available Widgets” and once under “Widget Area”
I didnt expect all of the fields to exist under the “Available Widgets” section. Is this correct or is it an issue with my code?
I only noticed because of your previous comment about keeping the Ids unique. I thought I was but with these two instances, Im not sure how to make them unique–they seem to be exact duplicates of all of the fields.
Forum: Fixing WordPress
In reply to: Does javascript work fully in Widget Option area?OHHHHHH I didnt realize that there is another instance of the widget on the page under “Available Widgets”.
Ok, I think it all makes sense. Although I cant see where to get the id of the instance to use in my Id. I can get the Ids of the fields, but not $this.id
Forum: Fixing WordPress
In reply to: Does javascript work fully in Widget Option area?It seems that javasrcript isnt working within the form tag that surrounds the elements you have chosen to be on your sidebar.
When I take this file local and modify it to move these couple of elements outside the form tag, it works.
Forum: Developing with WordPress
In reply to: Strange JS behavior with WP sidebarOk, I found the issue and solution. i really didnt think I would, which was why I posted here. But feel free to delete this post.
If you leave it, and it may help others, the issue was that the twentyfifteen theme has a js script that was setting the sidebar to fixed if it reached the top or bottom. My div didnt like this.
To solve this, I moved my off of the sidebar and into body, so it no longer had sidebar as a parent: document.body.appendChild(myMainDiv)
Forum: Developing with WordPress
In reply to: Strange JS behavior with WP sidebarThere is a section specific for sidebar scrolling. If anyone can make sense of this I would really appreciate it. Im hoping that in my script I can compensate for whatever it is the twentyfifteen.js is doing to make my div disappear.