If you dived into ‘How to compile WordPress 5.0 twentynineteen sass files you might mis the sourcemaps for the style.css. The sourcemaps are not generated by any of the commands without a small adjustment.
"build:style": "node-sass style.scss style.css --source-map true --output-style expanded && postcss -r style.css",
"build:style-editor": "node-sass style-editor.scss style-editor.css --output-style expanded && postcss -r style-editor.css",
"build:style-editor-customizer": "node-sass style-editor-customizer.scss style-editor-customizer.css --output-style expanded && postcss -r style-editor-customizer.css",
"build:rtl": "rtlcss style.css style-rtl.css",
"build:print": "node-sass print.scss print.css --output-style expanded && postcss -r print.css",
"build": "run-p \"build:*\"",
"watch": "chokidar \"**/*.scss\" -c \"npm run build\" --initial"
In the line with build:style you need to add: style.css –source-map, just as done above.
WordPress 5.0 is out! and it does not only come with Gutenberg but also with the new theme twentynineteen theme for WordPress. The theme is brilliant in its simplicity but that does not bring much elegance. So what if you want to change the styling? enhance or expand it? How would you start?. There are […]
To highlight search terms in the search results you can use the code below. Additionaly you will need to give search-highlight some special properties in your style sheet.
// highlight search terms
$keys = implode('|', explode(' ', get_search_query()));
$text = preg_replace('/(' . $keys .')/iu', '<span class="search-highlight">\0</span>', $text);
add_filter('the_content', 'highlight_results', 80);
add_filter('the_excerpt', 'highlight_results', 80);
add_filter('the_title', 'highlight_results', 80);
By default WordPress adds scripts by using the type attribute enqueing styles and scripts, the latest html validators throw a warning because this is redundent/ unnecessary Exmaple Here is an example of the default way WordPress includes scripts
// example: overcomplete
If you do not want attachmentpages to be indexed and you do not want comments on them
In this situation we want a custom field on checkout which has a jQuery Date selector:
* enqueue jquery datepicker script
* If is not admin (backend) and the page is
* woocommerce checkout add the field
I had to add a discount for local pickup and at first this looked easy. You can set the costs to be a negative amount. But if the subtotal for the order was smaller then the discount, they got the order for free. So I wanted the discount only if the order subtotal was more […]
You most likely have the analytics script on your site already. There are a few versions and this one uses the _gaq.push one not the ga(…)
var _gaq = _gaq || ;
ga.src = '<?= site_url('analytics.js'); ?>'; // mind you use a valid url
var s = document.getElementsByTagName('script'); s.parentNode.insertBefore(ga, s);
This line shows a copyright notice with the current year. Add it in your WordPress theme template somwhere.
echo "<span id='copyright'> Copyright © " . date('Y') . " PUDDINQ</span>";
At one site I have a custom role that can only view the orders. The owner wants some users to hav access without a password. Yes this story gets dumber.. He wants to give access by clicking a link. The basic script offered to autologin are hooked in to ‘plugins_loaded’ or ‘wp’. Both these hooks […]