Functions.php file - wordpress-theming

This is scripts. Php in which i enter all functions of the php which i have to included in functions file.. In this I add style and Javascript files..
Function my_style() {
Wp_enqueue_style('maincss', 'get_stylsheet_uri());
Wp_enqueue_style('myscript',
'get_template_directory_uri().'/assets/js/myscript.js');}
This is functions. Php file in which i hookup all those functions by adding action hooks and di action hooks..
Include(get_template_directory().
'/inc/Frontend/myscripts. Php') ;
Add_action('Wp_enqueue_scripts', 'my_style') ;
Plz tell me why its not working and its also not accepting my style. Css file. And then i add menus.. And also menus are not adding in websitee.. Also there is no error in compilation.

Related

Angular app, how to add html & css in the app component?

VScode error screenshotI generated a new component(bmi calc) in my angular app, then downloaded a html/css template of bmi calculator functionality and pasted the html and css content of the template into the bmicalc.component.html & bmicalc.component.css file in my app, but the app is not running?
This is my error(the image of my error)
As code given in your github files , below is working piece of code. I just updated your code.
You can check the updated code here on StackBlitz(Working) -
You can check demo here
Note : =I have just updated your code to make it work only as you got
those Uncaught error of compute function. Not sure about correct
calculation so you need to look on that part.
Just few suggestions
Add code snippet when you ask this type of question
Use appropriate names to variable, Avoid use i, ii, fv, kv type of variables.
.ts file is there to write presentation logic whatever you want to apply on the form.
Your code should be well-formatted. Clean html.
Avoid using inline css, Use .css file for it.

Convert php or phtml file to css

i develop a admin panel for manage colors in frontend. I don't want to add all color variables in theme files ( like header.phtml, footer.phtml, etc ) but i want to generate a file with all css class and color variables.
Ex.
<?php
$color = Mage::getStoreConfig('themeadmin/frontend/general_color');
echo '.top-header-container { background-color : #'.$color.'; } .menu { background-color : #'.$color.'; }';
?>
How i can do this without add this in theme file ? Can i generate a Css file ? what is the best way ?
Thanks
You can very easily simply call a .php file (or a controller action) as the actual stylesheet to be used.
ref: Include: css with php file extension?
So, considering that possibility you can do the following:
Create a controller action in your module.
Code for this action to simply output a valid formatted stylesheet
Add that action to your layout, via xml, or programatically inject the sheet into the layout, potentially via an observer event/model/controller action
example:
Mage::app()->getLayout()->getBlock('head')->addCss(
'dyncatprod/adminhtml.css'
);
Another possibility is to hook into the adminhtml save functionality (event should do) and generate one specific .css file form the admin options selected. The end result is one file, statically named, that you woudl then include normally. Make sure you provide a default base file for pre-saved instances.
This way would always ensure one file with the correct values, as a flat stylesheet.

Register a js file independently in Assets

I'm developing a module where I've some custom js functions to be use in a form inside a Dialog.
I successfully loaded as inline script in the view that launch the dialog that include the form with something like:
$script = <<< JS
var scheda=$("table#schedaTable");
var idtum=scheda.attr('idtum');
scheda.find("i.modifica.concessione").on('click', function() {
$("#concessioneDialog").load("/cimiteriale/concessioni/edit-concessione?idtum="+idtum).dialog("open");
});
JS;
$this->registerJs($script, $this::POS_END);
but for several reasons I prefer to use an external file published in assets so my question is:
Is it possible to publish an external js file with MyModuleAssets.php and register it later in the view independently from the other js assets, where needed?
In fact I need to close and reopen the dialog with other ids and so I need to register the js again several time.
Could someone give me an hint and maybe some pieces of the core code?
Thanks in advance
Luca
Assets are published as a package. So if you want some JS/CSS to be registered somewhere and others in another situations, you should create different packages and register each of them when needed.

Using dependencies in wp_register_style() for wordpress

I am trying to get a custom css file to load after the plugin stylesheets. I was thinking I could use the $deps parameter of wp_register_style(), but the css file does not load at all when I add the array(). This happens no matter what is included in the $deps array(), ie (array('style')
, array('style.css')).
Is there an issue with the call, or a better way of doing this?
In my functions.php
// Load custom css
add_action('wp_enqueue_scripts', 'prefix_add_my_stylesheet');
function prefix_add_my_stylesheet() {
wp_register_style( 'custom-supersized-styles', get_template_directory_uri(). '/css/custom-supersized-styles.css', array('style','supersized');
wp_enqueue_style( 'custom-supersized-styles' );
}
If you're using the WP Supersized plugin try registering your function like so:
// Load custom css
add_action('wp_enqueue_scripts', 'prefix_add_my_stylesheet', 999);
The dependencies array (the parameter you're attempting to use to add supersized with) depends on supersized having already been registered by WordPress. If you set the priority of your own prefix_add_my_stylesheet to a higher number, it should then load after the plugin has registered and loaded its CSS (and thus will be available).
In addition, you can remove the style as a dependency. (style is never registered by WordPress as a dependency handler, and your enqueued scripts / css should be loading after style.css loads anyway).
Hope that helps!

how to change the flash builder generate HTML to call function in actionscript?

I have an actionscript project, and I have provided the function that I want it to be called from HTML(the flash builder generated html file).
ExternalInterface.addCallback("getURL", getURL);
This is the code in actionscript, how can I modify the flash builder generated html file so that it can call getURL()?
Just add your function between <script> tags in index.template.html file that is located in html-template folder of your project.
alternatively, you don't have to use the html template, it's totally possible for you to create your own html and implement your own settings. Just go to the Project properties and uncheck the "Generate HTML..." checkbox.
as for your javascript function , you could have it in an external file and access it like this. it'd be easier to maintain, if the need to add more functions arises
<script type="text/javascript" src="external.js"></script>