This Base theme Code is developed using next tools:
It helps us to automate so that every time we make a change in our css we update the ./assets/main.css and we refresh the browser.
1- Go to /themes/fpsbaseTailwind
2- Open console in the fpsbaseTailwind directory, and type:
npm install
4- Open webpack.config.js and change the domain Here
const localDomain = 'http://webpack.local/';
5- Open the console and sun scripts
npm run dev
npm run prod
Note: important use script npm run prod when finished project or the update task
6- Enjoy
@mixin section-padding;
@mixin section-padding 90px, 120px;
@define-placeholder title--1 {font-size: 64px;line-height: 90px;}
@extend title--1;
Updating Plugins
Material icons Added to the framework
to use them from html:
<i class = 'material-icons'>name icon</i>
to use them from sass, through the mixin:
@include mIcons ('name_icon', font-size);
for example:
@include mIcons ('backup', 2.5rem);
Defaults values: Icon: 'backup', $font-size:18px
List with all the icons: https://material.io/tools/icons
Method used for Sass: https://github.com/google/material-design-icons/issues/150#issuecomment-163021143
This Framework is being development to get more useful and faster the develop of a new theme from Front Porch Solutions Company. The idea is the developer use it like base in each development of a site, it has functions, code, fields most used in a basic development but it will be the tool to start with your site. You'll find here:
This Base theme Code is developed using next tools:
This Base theme Plugins used are next:
It helps us to automate so that every time we make a change in our scss we update the style.css and we refresh the browser.
1- Go to /themes/Fpsbase
2- Open console in the fpsbase directory, and type:
npm install
4- Open gulpfile.js and change the domain Here
browserSync.init(files, {
proxy: "themebase.dev/",
});
5- Type gulp in console
6- Enjoy
Are ready to use, only you should add content.
To get these fields it's necessary to import .JSON
located in https://bitbucket.org/fps-dev/fpsframework/downloads/ . When you imported this file you will find the 'options' tab ready. The fields ready to use are:
<head>
<?php the_field('google_tag_header','option'); ?>
</head>
<body>
<?php the_field('google_tag','option'); ?>
</body>
<?php
$GETlogo = get_field('logo_site','option'); //FIELD USED
$logo = $GETlogo['ID']; //GET 'ID'
$size = 'medium'; // (thumbnail, medium, large, full or custom size)
?>
<a href="<?php echo esc_url(get_bloginfo('url'));?>">
<?php echo wp_get_attachment_image( $logo, $size ); ?> //FRIENDLY RESPONSIVE
</a>
<link rel="icon" href="<?php the_field('favicon', 'option');?>">
Located in footer.php
---------------------
<?php
if( have_rows('social_icons' , 'option') ):
while ( have_rows('social_icons' , 'option') ) : the_row();
$social = get_sub_field('social_icon');
?>
<a href="<?php the_sub_field('social_profile'); ?>" target="_blank" data-link-type="social" data-social-network="<?php echo $social['value']; ?>">
<i class="fab fa-<?php echo $social['value']; ?>"></i>
</a>
<?php endwhile; endif; ?>
Footer Default
--------------
<?php the_field('footer_info' , 'option'); ?>
Copyrights Field
----------------
<?php the_field('copyright' , 'option'); ?>
<?php the_field('newsletter_form','option'); ?>
[date]
The way to use in wp editor is:
-------------------------------
[button link="`add url`" color="primary" size="small" target="_self"]read more[/button]
The conversion is:
<a class="btn '.$atts["color"].' '.$atts["style"].' '.$atts["size"].'" href="'.$atts["link"].'" target="'.$atts["target"].'">'.$content.'</a>
These elements are located in js
folder .js
with all executed.
We defined two menus:
'menu-1' => esc_html__( 'Header', 'FPSBase' ),
'menu-2' => esc_html__( 'Footer', 'FPSBase' ),)
require('inc/shared-social.php');
Here are located Buttons
and Date
shortcodes
require('inc/shortcodes.php');
require('inc/pagination.php');
It means: Author Image
require('inc/author-fields.php');
The field:
__________
<?php the_field('author_image'); ?> //Image Author
* TML
* Confirmation Page
* Full Width Template
These pages are ready to be use, it means that each page have clean code and ordenaded.
* 404.php
* Author.php
* Search.php
* Archive.php
* Page-home.php
* Page.php
* Single.php
The base classes are located in _theme.scss
here defined:
Only you need to reuse all classes in this listed you need.
$primary: #5278FF;
$primary-hover: #3255c9;
$secondary: #36BDAD;
$secondary-hover: #279687;
$txt: rgba(60, 63, 77,0.80);
Just you need to change by site colors.
$font-family-base: 'Roboto', sans-serif;
$font-family-alt: 'Roboto Condensed', sans-serif;
There are two kind of Fonts Variable defined. You can create the extras you want.
Go to functions.php and about 65 line, exactly in FPSBase_scripts
functions replace:
wp_enqueue_style('google-font', 'https://fonts.googleapis.com/css?family=Roboto+Condensed:400,700|Roboto:400,500,700');
by your line generated in you font tool.
$font-weight-light: 300;
$font-weight-normal: 400;
$font-weight-base: $font-weight-normal;
$font-weight-bold: 700;
$font-weight-semi: 600;
This file is located in _partials/_gform-wrapper.scss
and here is defined some basic styles to help the forms of gravity form plugin
look better. You dont need worry about
validation error styles because here are defined, too.
When you import an Image Background, just can use this class:
.backgroundSettings;
`@extend .backgroundSettings;`
The styles you will import are next:
___________
background-position: center center;
background-size: cover;
background-repeat: no-repeat;
The function wp_get_attachment_image()
generates the srcset attribute allowing for responsive images!
The selected image when using the image ID return type. This example uses the wp_get_attachment_image()
function to generate the image HTML.
<?php
$image = get_field('image'); GET IMAGE ID
$size = 'full'; // (thumbnail, medium, large, full or custom size)
if( $image ) {
echo wp_get_attachment_image( $image, $size );
}
?>
The result is:
<img width="2274" height="2480"
src="URL" class="attachment-full size-full" alt=""
srcset="URL 2274w, URL-275x300.png 275w, URL-768x838.png 768w, URL-939x1024.png 939w" sizes="(max-width: 2274px) 100vw, 2274px">
Somethings, we need to have a full widht version of any content. Now, it's ready to be used:
<div class="full-content"> //use this class
....
</div>
There is a sidebar predefined and you can find it in page.php
<div class="content-area">
<div class="container">
<section class="flex-inverter">
<?php while ( have_posts() ) : the_post(); ?>
<aside class="sidebar">
<?php if(function_exists('subpages_menu')) { subpages_menu(); } ?>
</aside>
<div class="info">
<?php the_title('<h1 class="entry-title">' , '</h1>'); ?>
<?php the_post_thumbnail(); ?>
<?php the_content(); ?>
</div>
<?php endwhile; ?>
</section>
</div><!-- #main -->
</div>
Inside content-area
class are defined the styles to sidebar
works well. When the sidebar is activated or added the function of subpages_menu
is going to show all pages of sub menu if exist.
flex-inverter
class makes that in responsive view the content can be inverted. It means, the sidebar can be charged under general content. This class (flex-inverter
) could be used in whatever part of site development.
Here we talk about these:
-webkit-transition: all ease .4s;
-moz-transition: all ease .4s;
-o-transition: all ease .4s;
-ms-transition: all ease .4s;
transition: all ease .4s;
It helps with a good transition between elements. So, you need to import the class .fade
like here:
@extend .fade;
Change the value of the display property with our responsive display utility classes. We purposely support only a subset of all possible values for display. Classes can be combined for various effects as you need.
Screen Size | Class |
---|---|
Hidden on all | .d-none |
Hidden only on xs | .d-none .d-sm-block |
Hidden only on sm | .d-sm-none .d-md-block |
Hidden only on md | .d-md-none .d-lg-block |
Hidden only on lg | .d-lg-none .d-xl-block |
Hidden only on xl | .d-xl-none |
Visible on all | .d-block |
Visible only on xs | .d-block .d-sm-none |
Visible only on sm | .d-none .d-sm-block .d-md-none |
Visible only on md | .d-none .d-md-block .d-lg-none |
Visible only on lg | .d-none .d-lg-block .d-xl-none |
Visible only on xl | .d-none .d-xl-block |
Example:
<div class="d-lg-none">hide on screens wider than lg</div>
<div class="d-none d-lg-block">hide on screens smaller than lg</div>
To Learn more: https://getbootstrap.com/docs/4.3/utilities/display/
The classes are named using the format {property}{sides}-{size}
for xs and {property}{sides}-{breakpoint}-{size}
for sm, md, lg, and xl.
Where property is one of:
Where sides is one of:
Where size is one of:
Example:
<div class="mt-2">MARGIN TOP OF $spacer * .5</div>
<div class="mx-auto">CENTERED ELEMENT</div>
<div class="mx-4">MARGIN LEF AND RIGHT OF $spacer * 1.5</div>
To Learn more: http://getbootstrap.com/docs/4.3/utilities/spacing/
There are many elements from Bootstrap that we can use and it won�t be necessary to create new code lines. Here, there�s a list of most used:
http://getbootstrap.com/docs/4.3/components/alerts/
http://getbootstrap.com/docs/4.3/components/pagination/
http://getbootstrap.com/docs/4.3/components/collapse/
http://getbootstrap.com/docs/4.3/components/modal/
http://getbootstrap.com/docs/4.3/components/navs/
http://getbootstrap.com/docs/4.3/utilities/display/ - Hiding Elements + Mobile-Friendly - Good utility!
http://getbootstrap.com/docs/4.3/utilities/embed/
http://getbootstrap.com/docs/4.3/utilities/flex/
http://getbootstrap.com/docs/4.3/utilities/float/
http://getbootstrap.com/docs/4.3/utilities/position/
http://getbootstrap.com/docs/4.3/utilities/shadows/
http://getbootstrap.com/docs/4.3/utilities/spacing/ - Good utility!
Please, stay update with this documentation and read the rest of content about BootstrapX.