-
Notifications
You must be signed in to change notification settings - Fork 1
Usage Examples
- A directory for the examples
-
juanito
installed - Use standard HTML5 tags like
header
,footer
,aside
,nav
,article
Follow these steps:
-
Open your terminal
-
Create a directory:
mkdir mysite
-
Create a file called
index.html
insidemysite
-
Create and edit a basic HTML5 structure like the example
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Juanito Example</title> </head> <body> <header> This is the header </header> <section id="content"> This is the content </section> <footer> This is the footer </footer> </body> </html>
Consider to use tags like header
, section
and footer
. Juanito use these tags in order to recognize and organize the template.
5. Save the file as index.html
6. In your terminal create the template based on your recently created index.html
file using this command: juanito -s mysite -d mytheme
7. Input your theme configuration and test your theme on WordPress
Using the basic structure example we are going to create a menu inside the header
tag following these steps:
-
Edit
index.html
file -
Add inside
header
this code:<nav id="menu"> <ul> <li><a href="">Home</a></li> <li><a href="">Page 1</a></li> <li><a href="">Page 2</a></li> </ul> </nav>
-
Now, add the attribute
data-menu="main"
on thenav
tag<nav id="menu" data-menu="main"> ... </nav>
-
Save the file and execute
juanito
again like this:juanito -s mysite -d mytheme -i
. This process will be executed ignoring the configuration.
Using the second example, we are going to create a sidebar inside the section#content
following these steps:
-
Edit the
index.html
file. -
Add inside
section#content
this code:<section id="content"> <aside> </aside> </section>
-
Now, add the attribute
data-sidebar="home"
on theaside
tag<aside data-menu="home"> ... </aside>
-
Save the file and execute
juanito
again like this:juanito -s mysite -d mytheme -i
. This process will be executed ignoring the configuration.
Using the third example, we are going to create a sidebar inside the section#content
following these steps:
-
Edit the
index.html
file. -
Add inside
section#content
this code:<section id="content"> <div id="articles"> </div> <aside data-menu="home"> </aside> </section>
-
Now, add an
article
element insidediv#articles
with the elements for the 'title', the 'excerpt', the 'date', the 'permalink' and the 'thumbnail' and use dummy texts.<h3>Last 4 articles</h3> <div id="last_articles"> <article> <h4>Title</h4> <em>Sat, 14 Feb 2014</em> <div class="thumbnail"> <img src="http://placehold.it/250x100" /> </div> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p> <a href="">Read More</a> </article> </div>
-
Now configure "the loop" adding
data-loop="last_articles"
anddata-loop-limit="4"
in thearticle
element.<article data-loop="last_articles" data-loop-limit="4"> ... </article>
-
And now, we need to set the title, the date, the thumbnail, the excerpt and the permalink using:
<article data-loop="last_articles" data-loop-limit="4"> <h4 data-loop-title="">Title</h4> <em data-loop-date="">Sat, 14 Feb 2014</em> <div class="thumbnail" data-loop-thumbnail=""> <img src="http://placehold.it/250x100" /> </div> <p data-loop-excerpt="">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p> <a href="" data-loop-permalink="">Read More</a> </article>
For each element, every attribute must have the
data-loop
prefix. -
Save the file and execute
juanito
again like this:juanito -s mysite -d mytheme -i
. This process will be executed ignoring the configuration.
About these elements, the only thing that you have to do is create the files with these names:
- Use
page.html
orpage-<name>.html
in order to create page templates. - Use
archive.html
in order to create the archive template. - Use
single.html
to create the single post template.
In all these files you can use "the loop" data tags, explained on the 5th example
Consider this structure :
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Juanito Example</title>
</head>
<body>
<header>
<nav id="menu" data-menu="main">
<ul>
<li><a href="">Home</a></li>
<li><a href="">Page 1</a></li>
<li><a href="">Page 2</a></li>
</ul>
</nav>
</header>
<section id="content">
<h3>Last 4 articles</h3>
<div id="articles">
<article data-loop="last_articles" data-loop-limit="4">
<h4 data-loop-title="">Title</h4>
<em data-loop-date="">Sat, 14 Feb 2014</em>
<div class="thumbnail" data-loop-thumbnail="">
<img src="http://placehold.it/250x100" />
</div>
<p data-loop-excerpt="">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
<a href="" data-loop-permalink="">Read More</a>
</article>
</div>
<aside data-menu="home">
</aside>
</section>
<footer>
This is the footer
</footer>
</body>
</html>
Save the file and execute juanito
again like this:
juanito -s mysite -d mytheme
.
This process will be executed asking you for the theme configuration.