I am suing a wordpress contact form plugin that has a select box shortcode:
[select ID "option1""option2" "option3"]
Now in the browser, this will render as:
<select>
<option>Option1</option>
<option>Option2</option>
<option>Option3</option>
</select>
What I need:
I want to set the 2nd Option as the selected option, option2..
Now I know you do this by:
<select>
<option>Option1</option>
<option selected="selected">Option2</option>
<option>Option3</option>
</select>
BUT I cannot define that in the shortcode, AND I DO NOT want to do it using jquery, to accommodate people not having javascript enabled...
So how do I perhaps use CSS to set the second option as selected by default?
Thank you
The best thing you could do here is probably switch the values around.
I'm not sure if that is a possibility for you but it's the easiest solution by far w/o having to go round messing with either CSS / JS
Related
I'm using a plugin that has a 2-step dropdown for selecting a taxonomy. The frontend user selects a location from a dropdown selector. If the location has a child location, a second dropdown selector appears with the child location(s). The list is really long and I would like to be able to filter the list with a text field. Can I alter "Admin Select Box to Select2" plugin so that it will function on the frontend?
https://wordpress.org/plugins/admin-select-box-to-select2/
Yes, you can, by editing Plugin's core files, which is not recommended, but if you do not update the plugin it will be fine (or write your own method by copying plugin, it's rather a simple one).
Last line in file admin-select-box-to-select2.php, change:
add_action('admin_enqueue_scripts', 'amm_select2_enqueue');
to
add_action('wp_enqueue_scripts', 'amm_select2_enqueue');
I need to change the <option value> on the woocommmerce checkout country list and I have no idea how to do it.
I am using a font that I think it has a bug, and it changes the ... of Select a country... to the number 9, so instead of having Select a country... it shows Select a country9 on the drop down list.
I can't find on the internet how to change the option value text.
Could someone help me?
<select name="billing_country" id="billing_country" class="country_to_state country_select fl-select" autocomplete="country"><option value="">Select a country…</option>
You can have a try with unicode character, writing … instead of …
Reference: http://www.fileformat.info/info/unicode/char/2026/index.htm
I've taken over a plugin which relies heavily on Advanced Custom Fields. For further development I updated ACF from version 4 to the latest version (5.8.x).
The plugin includes styles and scripts relying on HTML element (e.g. input) IDs such as acf-field-header_caption, where header_caption is the field name. This works well with ACF 4, but in version 5, the much less coder-friendly field key (e.g. 5ac098bae96e4) is used for the IDs and classes, eg: acf-field-5ac098bae96e4. (The custom fields are added to a post_type and edited on that post_type in the backend.)
Example:
Input field in ACF v4 (what I need):
<input type="text" id="acf-field-header_caption" class="text" name="fields[field_5ac098bae96e4]" value="" placeholder="">
Same field in ACF v5 (what I don't want):
<input type="text" id="acf-field-5ac098bae96e4" class="text" name="fields[field_5ac098bae96e4]" value="" placeholder="">
Is there a way to revert back to HTML IDs in which the field names rather than the field keys are used?
John Huebner answered this question on the ACF support forum (thanks!).
There is no way to revert to the old class and ID format. This means, you have to update custom scripts and CSS when updating to ACF 5.
If one prefers to use the field name rather than the field key for the likes of jQuery or CSS selectors, one could use the data-name attribute in the wrapper div. Example for a selector referencing header_caption input field from above:
[data-name="header_caption"] input
(This works well for text fields, radio fields and their likes have multiple inputs within the wrapper.)
I quote the original answer:
No, there isn’t a way to revert the field ID values. The only place you will find the field name is in the wrapper div data-name="field_name_here".
In addition to the change in IDs and classes, even changing them would likely not help with the JS. If the JS is dependent on ACFs JS then it probably will not work anyway. The JS in ACF5 is completely different than ACF4 and any custom JS that interacts with it would need to be completely rebuilt.
Be lucky day, ;-), Today, I have difficulties in adding span tag in wordpress default comment content form by using jquery. Now, I added my span tag in wordpress comment content form (textarea) by using jquery. It didn't work and didn't show it, But, when I inspected with firebug, it can be visible in firebug!
<textarea aria-required="true" rows="8" cols="45" name="comment" id="comment"><span>Custom Span</span></textarea>
I understand, If I add only text using jquery, it can work and display, and then, if I edit the core code of wordpress, it can make it work, but, I don't wanna touch the core codes! So, Is there anyways to insert span tag(whatever tag) to put in wordpress default comment content form (textarea)
Wordpress Tiny MCE editor and WP own editor both has button for <blockquote> . if we select any text and press this buttom then it wraps that text with <blockquote>.....</blockquote>.
I want to change this output to this
<blockquote><div class="quote_start"><div></div></div><div class="quote_end"><div></div></div>...................................</blockquote>
How can i do this manually or is there any wordpress plugin which can do the same?
I want to change behaviour of blockquote button in bot editor TinyMCE and WP own html editor?
I'm not sure you can use this to add that many divs but tinymce's valid elements config parameter does allow you to replace tags.
http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/valid_elements
For instance:
tinyMCE.init({
valid_elements : "blockquote/div[class=quote_start]"
});
Would replace all blockquote tags with a div with the quote_start class.
A better way might be to ignore tinymce here and write a filter for the functions.php file of your theme. http://codex.wordpress.org/Plugin_API/Filter_Reference/the_content. Find all the instances of blockquote and replace it with the code you want.
Maybe adding your own button could also be an option?
Some starting point could be this:
http://www.deliciousdays.com/tinymcebuttons/
and/or this:
http://wiki.moxiecode.com/index.php/TinyMCE:API/tinymce.Editor/addButton
hope it helps? Greetz, t..
If you want the same functionality in two different editors, you're probably better off writing (or looking for) a Wordpress filter that can replace the code. There's this one but it doesn't seem to be able to handle regular expressions (which you would need to replace HTML tags). Maybe this one can do what you need: Text Filter Suite
Getting both TinyMCE and Quicktags requires mods in two places. Here's how to do the Quicktags:
http://website-in-a-weekend.net/extending-wordpress/diy-wordpress-unraveling-quicktags-wordpress-plugins/