Using PHP variables with CSS

Approach can be different but I find this an easy approach to use. Below example shows the use of PHP variables in CSS in a WordPress plugin. First, create a php file: dynamic.php (say). There just put the css codes where css properties are passed via php variables: <style> <?php $wss_color = get_option(‘ws_slider_settings’); $caption_color = esc_attr($wss_color[‘caption-color’]); $desc_color = esc_attr($wss_color[‘desc-color’]); $shadow_color = esc_attr($wss_color[‘shadow-color’]); if($wss_color[‘caption-color’]!==”){ ?> .wss-caption p{ color: <?php echo $desc_color ?>; opacity: 1; } <?php

Continue Reading

Properly Enqueuing Styles, Scripts, Fonts & Conditional styles

It is always a good option to enqueue your stylesheets & scripts in the functions. Generally, we enqueue our styles & scripts in ‘functions.php’. Enqueuing styles The basic function for enqueuing a style is: wp_enqueue_style( $handle, $src, $deps, $ver, $media ); You can include these parameters: $handle is simply the name of the stylesheet. $src is where it is located. The rest of the parameters are optional. $deps refers to whether or not this stylesheet is dependent on

Continue Reading

Standard head section of a WordPress Theme

# Valid DOCTYPE declaration: The declaration must be the very first thing in your HTML document, before the <html> tag. The declaration is not an HTML tag; it is an instruction to the web browser about what version of HTML the page is written in. # tag includes language_attributes(): Displays the language attributes for the html tag. Builds up a set of html attributes containing the text direction and language information for the page. # Correct

Continue Reading

Deceived by the light

One cool dark evening, a butterfly so beautiful was flying in its own rhythm; due to darkness may be it was a bit agitated too. After a while, a bright window catches its attention. So it flies towards that direction hoping it to be a safer & a better place. At the same time, someone opens the window & it gets in anyhow. The window then gets slammed suddenly. The small creature flies slowly &

Continue Reading

File Permissions: Be Aware !

#What is File Permission? There are all together 3 operations that are done in any file & directory: read, write & execute. So, file permissions specify who and what can perform these operations. #File Permissions as a structure Generally speaking, there are two categories that need to be considered when viewing file permissions: Actions and user groups. Actions your site’s plugins and files can make are: Read– allows access to a file to view its contents

Continue Reading