How to remove custom-css from Wordpress Database - css

I installed jetpack a while ago, but decided to uninstall and delete it. I was using the custom-css feature that it came with to style my site.
However, even after uninstalling it and deleting it the custom css I entered is still being loaded on my site. I did some research and this is because the custom css is stored in the database.
How can I remove this css from the database?
Thanks!

Not sure it will be the same for you according to the theme you use but for me it was that:
In functions/theme-head.php through Appearance > Editor, comment this line:
echo '<link rel="stylesheet" href="'. THEME_URI .'/css/custom.css?ver='.THEME_VERSION.'" media="all" />'."\n";

Related

How to find out where a script-tag has been defined in the wordpress-header?

I have to work in a wordpress project of a former colleague. But I cannot figure out how he added an link-address to a script into the header of each page. After a global search, the link-address was found inside the sql dump of the wordpress project. I could not find any plugin he might have used. I would like to change the link-address. Any idea, how he added it?
<script src="http://custom-link/page.js" type="text/javascript" defer=""></script>
It was added by the wordpress plugin divi builder.
Divi Theme Options
To add a code to every page navigate to Divi Theme Options > Integration tab.
Make sure the “Enable header code” option is checked, and paste your code below.

Bonno WordPress Theme Caching CSS updates indefinitely

Recently I purchased a WordPress Theme called "Bonno" (http://bonno.aisconverse.com/). It's a great theme, but there seems to be one major drawback: Anytime you make a stylistic change to the style.css (via the Appearance --> Editor), the update will not occur.
I've tried:
Shift + R on a browser
Installing a plugin to clear the cache (WP Super Cache)
Making a post on a completely different page via Post/Update (this
sometimes works, other times does not -- not sure how or why)
Has anyone else encountered similar issues on Bonno? Or any other WordPress themes?
To solve this problem your can add extra string right after the filename using a ? character.Edit the theme file to change the link tag.
Example-
<link rel="stylesheet" type="text/css" href="style.css?123">
However it gets static and next time if you change the CSS again you might not get the update instantly. For this, you can use PHP to add the string dynamically by using time() function.
<link rel="stylesheet" type="text/css" href="style.css?<?php echo time(); ?>">
And now you can get instant update of your changes. This will not affect your CSS file.

CSS of Blank Theme Does NOT Show My Edits - Why?

On Wordpress.org, I activated a BLANK theme by Chris Coyier.
I edit index.php and my changes are showing up on my website. Fantastic.
I edit the existing style.css file but none of my edits are showing up. Ugh.
I delete style.css and the website still works. Why?
I repeat these steps with a different blank theme. Same issues.
Questions
Why am I unable to edit style.css of ANY blank theme? I am confused because I am able to edit style.css of Twentyfourteen theme.
If I delete style.css from the blank theme, the website still works and still shows the same CSS styling. How is this possible?
For blank themes, the stylesheet is called in header.php as
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" />
But for Twentyfourteen theme, I don't see any call for a stylesheet.
Why do regular themes not have a call for a stylesheet in header.php? Is this why I cannot edit style.css of blank themes?
Most likely your browser is caching the CSS?
What happens when you use your browsers dev tools to check the CSS source.does that show your edits?
When you say "delete the CSS" do you get a missing resource error on the browser console?
If it does not, try force reloading your page.

Linked Stylesheet in WordPress

I am trying to build a second .css file for my company's website.
Currently, we are using a responsive theme, so most of our content displays correctly on desktop and mobile browsers. However, recently the boss is requesting custom code that is unresponsive. In order to keep the site looking good, I want to apply a secondary stylesheet that contains formatting for mobile devices. It would be like this for any html page:
<link rel="stylesheet" href="http://domain.tld/mobile.css" type="text/css" media="handheld" />
I cannot figure out how to get this into a wordpress child theme correctly. Can anyone offer suggestions?
Thank you in advance.
Look for the header.php file in your child theme directory, or under "Appearance"->"Editor" in the main menu of the your Wordpress adminpanel. You can paste the link to your new stylesheet there.
Also consider moving the styles to your theme's directory and replacing the domain in your href with <?php echo get_stylesheet_directory_uri(); ?> (example from wordpress codex).

How can I set the main theme-font dynamically, in WordPress

I have created a theme where I already have a custom options page where I let the user set text for footer, twitter user and some other things and that works well.
Now i'd like to add the functionality of letting the user that installed the theme select which font that should be used for content on the site. How can i accomplish this? I can probably create a php file that outputs something like:
<style type="text/css">
body{
font-family: <?php echo get_option('my-font');?>;
}
</style>
and include that file in header.php, but that means that I have to hit php for every request for this css and I want to avoid that if posssible.
Actually, I'd recommend placing that code directly in your header.php file. You'll already be parsing PHP code, so there's no reason you can't parse that get_option() request at the same time. I've used a similar system to generate a random header image on each page load based on WordPress options before as well.
For one theme I built, there were CSS options aplenty, so I decided to generate static CSS files when the user made changes. To get around caching, I would store the timestamp of the last update, and echo it out as a parameter in the CSS URL;
<link rel="stylesheet" type="text/css" href="/path/to/generated/css.css?ver=<?php form_option('theme_name_css_timestamp'); ?>" />

Resources