Relative to the wp_enqueue_style() In documentation says:
(string) (Required) Name of the stylesheet. Should be unique.
But this is not clear to me if is a value you need to give to set a unique reference in the moment to enqueue the styles or you need to pick it up from the file name or directory.
Where this value come from?
To me is not clear in documentation. I've read some tutorials about it, but still is not clear to me.
You should give a unique name for your script, e.g:
wp_enqueue_style('myCustomStylesheet12345', 'path_to_stylesheet/stylesheet.css);
For example:
If you later try to enqueue something with the same given handle, it wont be added. (you have to add unique name for both, or remove previous if already enqueued before enqueue the second one.)
Related
I want to format all decimals fields in all Module in which some calculations are saved using logic hooks. When I save them in EditView, it shows like 54,679.00000 instead of showing it 54,679.00 .
How do i remove the trailing zeroes ?
SuiteCRM use format_number function from the Currency module to formate different fields(Int, Float and Currency, etc). You can find its definition it this file: modules/Currencies/Currency.php and modify the format_number function according to your needs.
Moreover, you can find different fields definition in this folder: include/SugarFields/Fields/. There will be a folder for every type of field(e.g. custom/include/SugarFields/Fields/Float). You can see that there will be DetailView.tpl, EditView.tpl and a base class PHP file which contains the helping methods of every field type. If you copy include/SugarFields/Fields/<field_type> to the custom folder at the same location(e.g. custom/include/SugarFields/Fields/Float) then you can do the changes in that field type in upgrade safe manner as well.
Hopefully, that will help you to resolve your current issue and you can do the changes in single place :)
The context of my problem :
I have a website multi-language ( 20 ), I use less css.
All stylesheets are common, except one for every country called to the end.
I have a file com.base.less which has a variable of font.
Every stylesheet calls this file to use the variables which it contains.
My question, for a country I must change the font, thus to re-declare the variable only for this country.
How can I proceed?
Because if I re-celare my variable in my file of country, that this being called to the end it isn't written again.
I use lessPhp, and I see ModifyVars but I don't know if it's good method ?
(when I test he doesn't work)
Thank you
Yes, as the docs tell you "You can use the ModifyVars() method to customize your CSS if you have variables stored in PHP associative arrays".
Less uses the last declaration wins rule for variables, so the last re-declare value of variable at the end of your code will be used everywhere in your code.
I use lessPhp, and I see ModifyVars but I don't know if it's good
method ? (when I test he doesn't work)
Make sure that you call ModifyVars() before getCss() and call both on the same instance of Less_Parser.
I am using this standard function to displayy comments on a website running Wordpress 4.0:
wp_list_comments();
However, that way comments by registered users are shown with their username instead of their first and last name. This is obviously also a security risk.
Anyway to influence this function to give our first and last names or do I have to do a workaround?
Thanks!
Wordpress will always list the preferred Display Name your users can set in their profile settings. Just have them set it to their preferred name there and you are good to go.
I have a Drupal filter module whose output I would like to alter, depending on where the output is going to be displayed. Specifically, I want to the filter to give the full output for nodes, but trim the content down for blocks.
I don't think this would be possible. It's hard enough to figure out what context something is being displayed in. It's doable but quite hard to code on your own. However the way the filter system works I don't think its possible within a filter to determine then context of the text being filtered. It's simply not made for something like that.
I'm the OP (but just registered an account).
I did manage to find a solution/workaround. Here's what I did:
Create block.tpl.php in my module which is a copy from system/block.tpl.php, with a constant added at the top.
Put my template file at the head of the theme registry using hook_theme_registry_alter():
function hook_theme_registry_alter(&$theme_registry) {
// using our own block.tpl.php file.
$theme_registry['block']['template'] = 'block';
$theme_registry['block']['path'] = drupal_get_path('module', 'module_name');
$theme_registry['block']['type'] = 'module';
$theme_registry['block']['theme path'] = drupal_get_path('module', 'module_name');
$theme_registry['block']['theme paths'] = Array();
}
Checked for the constant while constructing the filter output, changing as necessary.
Celebrated the outcome.
I would like to restrict the fields while creating a new post in WordPress. For the title, it should not exceed 40 characters. For the content, it should not exceed 400 characters. If these maximum values are exceeded, I would like to show an error message and not let the user continue. How do I do that in WordPress?
You should be able to use wordpress filters to modify the code that gets outputted when the editor is called. Essentially you would want to use it to insert some javascript and an extra div tag to display your error, then just read the contents of the "editorcontainer" id and show the error once it reaches a certain character limit.
I don't have the time at the moment to write a case example, but depending on your skill level, the functions you are looking for are:
apply_filters("the_editor", "customfunction_limitarea");
Where customfunction_limit area is your created function to insert the javascript. You can see how the_editor is currently called and how the default filters are applied in "wp-includes\general-template.php" on line 1822. The default looks like this:
$the_editor = apply_filters('the_editor', "<div id='editorcontainer'><textarea rows='$rows'$class cols='40' name='$id' tabindex='$tab_index' id='$id'>%s</textarea></div>\n");
I would try modifying that statement by placing a new filter in a functions.php file located in your themes directory, that way you don't have to worry about it getting over-written during an update. Otherwise, if you absolutely have to edit the wordpress core (generally a no-no), general_template.php would be the place to do it I think.
Essentially just read up on wordpress filters a little bit (be warned there's not a ton of documentation or examples available for it other than the basic stuff), and that should provide everything you need. The input verification end is easy enough to find scripts, just google jquery post limiting. Something like this might be exactly what your looking for:
http://swiki.fromdev.com/2010/02/jquery-maximum-limit-texttextarea-with.html