Wp-less-cache issue changing CSS - php

I'm making a web with a Wordpress and modifying some things with a child and css theme. The problem is that the theme uses a folder with the name "Wp-less-Cache" and inside it introduces a "theme-less.css" that it generates automatically. The problem is that now when I try to modify something by css the my mytheme.css (in the child) does not leave me because it tells me that what I want to retouch belongs to the file "theme-less.css" .... and if I tweak the CSS directly in that, it works but when this file is generated again automatically after a while it deletes the modifications that I had made in it.
I would like to know:
Can you disable the wp-less-cache? it is not in my list of plugins or among the plugin folders ...
Can I do something so that my modifications of the child theme are effective if he is active?
Thank you very much

It is used by one plugin called tlg_framework which is a built in plugin with themes that developed by http://www.themelogi.com/

Related

Where should the code for a WordPress hook function be located?

I am new to Wordpress/WooCommerce and PHP, although I have experience in other web platforms and languages.
I have read numerous articles about adding code to WooCommerce and where to place your code, and of course there are many different answers.
It seems that the most common answers are to place you code in the child themes functions file, while others say that you should create your own plug-in and place the code there.
I am leaning toward my own plug-in so that if the theme is updated or changed, the code wont be lost.
Can a hook (created by calling add_action()) and it's associated function be
created in my own plug-in?
Thanks,
Eric
Yes, you can override actions/filters of wordpress or any other plugin via your plugin.
Apart from that, if you use child theme (inheriting parent theme) you do not loose the customization you have made via child theme even when the parent theme is updated.
If the theme is changed all together, there is possibility that your customization may behave different as the actions/hooks can be used differently in themes.
Hope this helps.

Is it possible to hook a text box into a WordPress theme, via the functions.php file?

I am currently using a WordPress theme to create an ecommerce website. I am looking to create a horizontal text box, with 3 columns, to appear directly beneath the Main Menu navigation. Rather than edit the header.php file, and risk breaking the theme, is it possible to achieve this by hooking into the theme, via a functions.php file in the child theme or would thus be bad practice?
So adding "right after the main menu" is not something WordPress will be able to give you directly, no. Because, by definition, the structure of a page is a theme's responsibility.
That would be a perfect case for a child theme, and it would be my first choice. There you can safely override the index file (or header file, depending on how the theme is built) and add your html to it.
Another option a child theme might give you, is adding html through the theme's own filters and actions - but that will totally depend on your theme giving you such hooks.
Finally, if truly you want to add right after the main navigation, you might look at the wp_nav_menu filter: using that, it should be possible to first detect if you are looking at the main navigation or not, and if you are, append your own html. But frankly, I think the risk of breaking your layout is greater with that method.
Hope this helps!

How can I avoid Wordpress theme upgrades changing my parent themes functions.php?

I have currently manually implemented a tracking code in wp-content/themes/genesis/header.php
The code looks like this (shortened):
<script>
CODE HERE
<?php if (is_single()){CODE HERE}?>
CODE HERE
</script>
</head>
Whenever I upgrade genesis (the Wordpress theme) this code is lost and I have to manually add it again.
How can I add this code via the functions.php to the head section in wp-content/themes/genesis/header.php so that it survives a Wordpress theme upgrade - how would the code look?
You need to use wp_head hook to add content to the <head></head> dynamically.
Your code would look like this:
add_action('wp_head', 'change_this_name');
function change_this_name(){
?>
<script>
CODE HERE
<?php if (is_single()){CODE HERE}?>
CODE HERE
</script>
<?php
};
Generally, the solution for modifying your theme without having your modifications overwritten is using a child theme. But you could also create a small plugin that would do the same thing you want to do here.
Which option you take is generally much of a muchness for now, but if you are planning more changes in the future, you should keep in mind that:
plugins are for adding functionality
themes are for controlling how things look and feel
This might help you decide which option is best to take now (although you can easily do both, or change later if you wish :)).
Option 1: Creating a child theme
Create a new folder in the wp-content/themes folder (name it whatever you'd like to call your new theme), and then create a style.css in that folder.
At the top of style.css you'll need to include defining information for your theme. You can copy the format for this from the Genesis theme, just change the name and other details so it's clear when you go to activate it that this is your theme.
The key here is then to add a new line to this theme info reading:
Template: genesis
That line tells Wordpress that your theme will be a child theme of Genesis, and anything your theme doesn't provide, Wordpress will grab from Genesis.
The key here is then to override only what you want to and let the rest fallback to Genesis.
So, you could copy the header.php and add your code in, but then you'll still need to update the rest of the file if it changes. A better solution would be to create your own functions.php in your new child theme and use the following:
add_action('wp_head', function(){
?>
Enter tracking code here...
<?php
});
This will then hook into Wordpress' head action and print out the tracking code right where you want it, without you having to muck around with the rest of the header.
Of course, once you're ready, go to Appearance -> Themes in Wordpress and you'll see your new theme there. Activate it and check your site!
For more background and tips on child themes you can see this page on the Wordpress Codex.
Option 2: Creating a plugin
If it's just functionality you want to add to your site, you may find a plugin more helpful - particularly because you can change themes later and easily keep your plugin, and you can activate it and deactivate it at will.
You can create as many plugins as you like if there is more functionality you want to add later.
The process is fairly similar to creating a theme above. Instead of creating the new folder in the wp-content/themes folder, stick it in wp-content/plugins instead. Then, create a .php file in that folder (eg. myplugin.php, but you can call it whatever you like), and add the following to the top of the file:
<?php
/*
Plugin Name: My Toolset
*/
(You can add additional information if you wish, more information is available on this page of the Wordpress Plugin Handbook)
Under this, simply place the exact same add_action() code mentioned in the theme option above.
Save your file, go to Plugins in your Wordpress admin, find your new plugin in the list, click Activate, and check your site!
For more background and tips on plugins you can see this page on the Wordpress Codex.

Wordpress lost link after theme update. [Enfold Theme]

I'm by no means a coder or programmer but i have enough to understand my part and fix small issues or adjust look with basic CSS, and so friend of mine asked me for help and here i am two days later asking you)
There is a Website running Enfold theme which recently were updated and so was lost custom image link at right part of header made by someone-else.
I have restored link code from Cached version of website but have no real understanding how and where to add it back to theme templates. Would appreciate any help, solution, link, advice.
Cheers.
A wild guess, since I don't have Enfold theme (the best would be to ask on the official support), but in your div #header_main in the .inner-container, you had after the #advanced_menu_toggle this piece of code:
<img src="http://vcmt.ca/wp-content/themes/enfold/images/layout/canvas.jpg" alt="canvas" style="max-height:70px;">
Just open the .php file that has the header in it, and paste this code back in. Since the canvas.jpg was located in the /images folder of the theme, that is also gone, so my recommendation is to download the image from the cached version if you can and put it back in the image folder.
Also it would be better to make changes to child theme, so that you can update the functionality of the theme, without loosing any custom added modification, like this site had.
If you're planning on changing the CSS in any WordPress Theme, you want to make sure that you have a child theme installed. The child theme allows you to change/overwrite the CSS and Theme Functions on the theme without losing those changes everytime the theme updates.
You can download the Enfold Child Theme Here:
https://kriesi.at/documentation/enfold/how-to-install-enfold-theme/#why-child-theme
...and if you need to add HTML to the header, you can do so by duplicating the header file from the theme, adding a header file to the child theme, and making your changes in the child theme header file.
Hope this Helps!

how to use bootstrap3 theme with Yiistrap extension in Yii framework (bootstrap version 2)

i am using an admin theme in my backend which uses Bootstrap 3.0 css (used as main layout). while i have the yiistrap extension installed which uses bootstrap 2 css files(for my grids and other widgets), now if i use both at the same time, every thing breaks (usually theme), it is obviously because both versions are used, and one overrides the css of another.
i need to know if there is a way where i can differentiate both css, or render one after another is some way? or would i have to make my own template/theme using yiistrap files?
let me give you an example, i have theme layout in my main.php (layout), all theme files added on this file, next, i render my user/admin view, which contains a GridView of Yiistrap, now as you can see my problem, both CSS files are needed to render everything correctly, Hance lies my problem. i want to add both files at the same time, but not to conflict with each other. Does YII provide a solution for this? becuase this can Happen to any theme i use, not only bootstrap.
Yiistrap has a method called register which will load all CSS and JS files into the rendered html. As far as I know this has to be manually triggered at some point in your application life cycle and is usually done with Yii::app()->bootstrap->register(). You should be fine if you remove that call and replace it with your call to the Bootstrap 3 loader instead.
Edit
Let me clarify my answer a little. Right now I assume that you are calling Yii::app()->bootstrap->register() somewhere in your application as well including Bootstrap 3 files. This, as you noticed, results in a conflict.
Yii::app()->bootstrap->register() will only include CSS and JS files directly necessary for Yiistrap. So either removing this call completely or conditionally replacing it with your Bootstrap 3 includes should solve the issue.
You can rename the assets folder of bootstrap and also define path as new folder name in admin and place the admin theme correct. i.e.
theme/[your_theme_name]/views/layouts [here you should place main theme files and write yiistrap code in head tag for bootstrap's assets files]
theme/[your_theme_name]/views/admin [here you should place admin theme files]
If you place files correctly as well as assign the path of assets files correct in the <head></head> section of main theme file, I believe you would not fall in any trouble.

Categories