How to merge css in wordpress - html

I want to merge all css into one file. I can do manually but I don't understand last argument of wp_register_style.
From laptop it's load all css.
wp_register_style('desktop-small-css', get_template_directory_uri().'/css/desktop.small.css','','','(max-width:'.get_option($dynamo_tpl->name . '_theme_width', '1230').'px)');
wp_enqueue_style('desktop-small-css');
wp_register_style('tablet-css', get_template_directory_uri().'/css/tablet.css','','','(max-width:'.get_option($dynamo_tpl->name . '_tablet_width', '1030').'px)');
wp_enqueue_style('tablet-css');
wp_register_style('tablet-small-css', get_template_directory_uri().'/css/tablet.small.css','','','(max-width:'.get_option($dynamo_tpl->name . '_small_tablet_width', '820').'px)');
wp_enqueue_style('tablet-small-css');
wp_register_style('mobile-css', get_template_directory_uri().'/css/mobile.css','','','(min-width:'.get_option($dynamo_tpl->name . '_mobile_width', '580').'px)');
wp_enqueue_style('mobile-css');

https://codex.wordpress.org/Function_Reference/wp_register_style,
I guess it's a mediaquery, find out which stylesheet is for which device and remove/edit the $media option.
It might be a lot easier to remove the $media option of all wp_register_style and add #media() media queries inside your stylesheets.

Related

How to Print each row in the list table in a separate page. NetSuite Advanced PDF

I am trying to print each row in the picking ticket on a separate page and for now, am using the Row height to move each item to a new page but this is something not professional cuz when I made any change in the template the format is totally changed and this solution will not work so, I am looking for a style to make this solution more dynamic whatever the changes that may happen to the other tables in the PDF.
You can use the css property page-break-after: always for this purpose.
e.g.
<style>
div.ps { page-break-after:always}
</style>
...
<div class="ps">
... ps details
</div>

Wordpress CSS issues

I'm having some really weird issues with converting a static HTML page to a wordpress custom theme. I have a style css sheet and a foundation css sheet as I am using that frameowrk.
The CSS works perfectly on the static html page but when it goes to wordpress there are issues with the font including the colour and size. Is there a specfic way you should be importing the CSS or a conflict I should be aware of?
The CSS of both are added to the page because I can see them in style editor when I 'inspect element'. I enque the scripts as shown below;
// Adds the css to the theme
function add_theme_scripts()
{
wp_enqueue_style('styles', get_stylesheet_uri() );
wp_enqueue_style('foundation', get_template_directory_uri() . "/css/foundation.css" );
}
add_action('wp_enqueue_scripts', 'add_theme_scripts');
I didn't know if it was to do with any form of config error or just faulty files so I recreated the theme from scratch and the problem persisted.
If someone could perhaps point me in the right direction it would be very appreciated.
Thank you.
-Edit-
I've checked inspect element and removed all the addtional CSS that has been added by wordpress and the problem persists.
try to view source and check any other css are included in the page. May be some plugin css is conflicting with your css. If any plugin css conflicting deactivate that plugin and then change.
If you are en-queuing css file in parent theme.Try like this
function add_theme_scripts()
{
wp_register_style( 'foundation', THEME_DIR . '/css/foundation.css', array(), '1', 'all' );
wp_enqueue_style( 'foundation' );
}
add_action('wp_enqueue_scripts', 'add_theme_scripts');

Adding custom css to default style.css (Underscores _S Wordpress theme)?

I'm currently building a custom theme on top of the _S Underscores Wordpress theme. One of the things I immediately did was remove all the content in the style.css file, as I want to create my own styling (largely using Bootstrap).
However, I can't seem to get certain attributes in the style.css to make changes to the html. For example, I'm trying to set the following <h1> tag to red. But it will not change.
<h1 id="testOfContent">Test</h1>
CSS (in the style.css file provided by Underscores):
#testOfContent {
color: red;
}
However, the font remains black. How do you manipulate a wordpress theme (especially _S Underscores which is meant to be customizable) to use your own css? Any ideas as to why it won't register my own CSS?
Here's my functions.php file and how I'm loading the script:
function tlas_css() {
// Enqueue bootstrap css
wp_register_style('bootstrap-css', get_template_directory_uri() . '/bootstrap-3.3.4/css/bootstrap.min.css');
wp_enqueue_style('bootstrap-css');
// Enqueue custom stylesheet
wp_enqueue_style( 'tlas-custom-style', get_template_directory_uri() . '/css/tlas.css' );
wp_enqueue_style( 'tlas-style', get_template_directory_uri() . '/style.css');
}
add_action( 'wp_enqueue_scripts', 'tlas_css' );
You should use wp_enqueue_style( 'your-style', get_stylesheet_uri() ); which retrieves the URI of the current theme stylesheet.
Read more on codex.wordpress.org
The workflow I prefer to customize and add to the css for the _s theme is by editing the .scss Sass files. Be sure to select the Advanced Options so you can tick the _sassify! check box if using the _s theme Generator at https://underscores.me/#generator
Then you can import the Bootstrap Sass you want since Bootstrap 4 is written with Sass. If you prefer using Bootstrap 3, you can find it's Sass ports as well.
If you're not sure how to build the Sass, I put together a Webpack 4 development workflow for the Sassify option included with the underscores Wordpress starter theme. Hope this helps https://jimfrenette.com/2018/08/completely-blank-no-css-_s-wordpress-starter-theme/
If you are working with Chrome, try to clear cache (ctrl+F5).
Or Open Dev tools > settings > preferences > network > disable cache (when dev tool is open)
You can try this one:
add_action( 'wp_enqueue_scripts', 'yourstyle' );
function yourstyle() {
wp_enqueue_style( 'yourstyle', get_template_directory_uri() . '/css/yourstyle.css', array(), PARENT_THEME_VERSION );
}

How to avoid Animation data be covered by cocos2dx?

I use cocostudio to create some animation export files , it has .ExportJson , .plist , .png .And I use following code to load it in cocos2dx 3.2:
cocostudio::ArmatureDataManager::getInstance()->addArmatureFileInfo("monkey_die/monkey_die.ExportJson");
cocostudio::ArmatureDataManager::getInstance()->addArmatureFileInfo("monkey_jump/monkey_jump.ExportJson");
cocostudio::ArmatureDataManager::getInstance()->addArmatureFileInfo("monkey_run/monkey_run.ExportJson");
But when I want play the monkey_run animation use :
cocostudio::Armature * armature = cocostudio::Armature::create("monkey_run");
addChild(armature);
armature->playWithIndex(0);
The animation is monkey_die! So I change the code :
cocostudio::ArmatureDataManager::getInstance()->addArmatureFileInfo("monkey_run/monkey_run.ExportJson");
cocostudio::ArmatureDataManager::getInstance()->addArmatureFileInfo("monkey_die/monkey_die.ExportJson");
cocostudio::ArmatureDataManager::getInstance()->addArmatureFileInfo("monkey_jump/monkey_jump.ExportJson");
I just let run in front of die . The I can play the monkey_run correctly.
I'm green hand to cocostudio. So I think it must be the export files' problem . I use some default name in cocostudio. Which of them can cause the problem?
I got this resolved recently. It is because the same image file name. For example, in your three animations, you may have this file: monkey_head.png. Try to rename the image file into different names, like monkey_head_die.png, monkey_head_jump.png. And do the same thing for rest of images. Hope it helps.
Leo

How can I combine 2 CSS classes into one?

I'm working with bootstrap, and trying to get the right classes on various elements for appropriate layout on various devices. It seems for many, I want something like control-label col-md-2. So I can go through a couple dozen elements, and change them all, but then - what if I realize I really want col-md-9? I then have to go through each element and change the classes! So what I'm trying to do is:
<label class="label-class"/>
with
.label-class {
control-label col-md-9
}
Is this possible? Every answer I've found online about combining classes relates to a different type of question. Alternately, if I'm going about this all wrong, I'm willing to learn a better way to test various layouts :)
Edit:
After some more searching, I found Can a CSS class inherit one or more other classes? - seems like maybe the answer is 'not without additional utilities' sadly.
You can achieve it, but not with CSS. You could use LESS files, and with the proper medium to parse from LESS to CSS file (and "casually" Bootstrap core is written in LESS, ;D). The specification you're looking for is: http://lesscss.org/features/#mixins-parametric-feature
Bootstrap allows you download the LESS files of its code to modifications, and then, you may use a JS compiler as said in lesscss.org/usage/#using-less-in-the-browser
If you're using PHP, there are some libraries to compile it before send it to the browser, the latest is going well with Bootstrap 3.0 and that I'm using is: http://leafo.net/lessphp/
Hope this helps, XD
If you don't want to use .less and a compiler, you could use jQuery to add classes onready:
$(document).ready(function() {
$('.label-class').addClass('control-label col-md-9');
})
You can make a whole set of these in an easy to edit function mixing up bootstrap classes(btn-1 & btn-2) add custom classes (btn-3) and even inline css (btn-4 - but don't overdo this one - it gets messy fast).
$(document).ready(function() {
$('.btn-1').addClass('btn btn-danger btn-xl');
$('.btn-2').addClass('btn btn-warning btn-xl');
$('.btn-3').addClass('btn btn-success btn-sm custom-class-1 custom-class-2');
$('.btn-4').addClass('btn btn-warning btn-xl').css('text-decoration','underline');
#Chococroc is right. Here are simple steps:
Step1: Write style.less
.label-class {
.control-label;
.col-md-9;
}
Step2: Add less.js
<link rel="stylesheet/less" href="style.less" type="text/css" />
<script src="script/less-1.3.3.min.js"></script>
Remember, js will call after including the less in page.
More information about less rules are available at: http://lesscss.org/