Last active
July 14, 2016 13:43
-
-
Save AndreaBarghigiani/7628757531751fcebbf9acfa893d0cb1 to your computer and use it in GitHub Desktop.
Lezione 3: Crea il tuo primo tema WordPress (https://skillsandmore.org/corsi/crea-tema-wordpress/)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if( !function_exists( 'skam_setup') ){ | |
function skam_setup(){ | |
//Aggiungo il supporto al tag <title> | |
add_theme_support( 'title-tag' ); | |
//Mostro il link del feed all'interno di <head> | |
add_theme_support( 'automatic-feed-links' ); | |
//Aggiungo il supporto al caricamento del logo con misure standard | |
add_theme_support('custom-logo', array( | |
'width' => 300, | |
'height' => 60, | |
'flex-width' => true | |
)); | |
//Aggiungo un nuovo menu | |
register_nav_menus( array( | |
'primary' => __( 'Principale', 'skam' ), | |
) ); | |
} | |
} | |
add_action( 'after_setup_theme', 'skam_setup' ); | |
function skam_widgets_init() { | |
} | |
add_action( 'widgets_init', 'skam_widgets_init' ); | |
function skam_scripts() { | |
wp_enqueue_style( 'skam-style', get_stylesheet_uri() ); | |
} | |
add_action( 'wp_enqueue_scripts', 'skam_scripts' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* La testata del nostro tema. | |
* | |
* @package skAM | |
*/ | |
?><!DOCTYPE html> | |
<html <?php language_attributes(); ?>> | |
<head> | |
<meta charset="<?php bloginfo( 'charset' ); ?>"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="profile" href="http://gmpg.org/xfn/11"> | |
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>"> | |
<?php wp_head(); ?> | |
</head> | |
<body <?php body_class(); ?>> | |
<div id="page" class="site"> | |
<a class="skip-link screen-reader-text" href="#main"><?php esc_html_e( 'Skip to content', 'skam' ); ?></a> | |
<header id="masthead" class="site-header" role="banner"> | |
<div class="site-branding"> | |
<?php | |
//Mostro il logo caricato | |
the_custom_logo(); | |
if( !has_custom_logo() ): | |
?> | |
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1> | |
<?php | |
endif;//!has_custom_logo() | |
$description = get_bloginfo( 'description', 'display' ); | |
if ( $description || is_customize_preview() ) : ?> | |
<p class="site-description"><?php echo $description; /* WPCS: xss ok. */ ?></p> | |
<?php | |
endif;//$description || is_customize_preview() | |
?> | |
</div><!-- .site-branding --> | |
<nav id="site-navigation" class="main-navigation" role="navigation"> | |
<button class="menu-toggle" aria-controls="primary-menu" aria-expanded="false"><?php esc_html_e( 'Primary Menu', 'skam' ); ?></button> | |
<?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_id' => 'primary-menu' ) ); ?> | |
</nav><!-- #site-navigation --> | |
</header><!-- #masthead --> | |
<div id="content" class="site-content"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php get_header(); ?> | |
<div id="primary" class="content-area"> | |
<main id="main" class="site-main" role="main"> | |
<article id="post-1" class="entry"> | |
<header class="entry-header"> | |
<h1 class="entry-title">Il mio primo articolo</h1> | |
<div class="entry-meta"> | |
<time class="entry-date published" datetime="2016-07-15T14:00">15 Luglio</time> | |
<span class="author vcard"><a class="url fn n" href="http://skillsandmore.org/author/andrea">Andrea Barghigiani</a></span> | |
</div><!-- .entry-meta --> | |
</header><!-- .entry-header --> | |
<div class="entry-content"> | |
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Maxime, dolorem, laudantium. Obcaecati sed natus et sint repudiandae ipsam qui amet iusto, totam voluptatibus impedit quo? Provident mollitia molestias, iure cumque.</p> | |
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Earum distinctio omnis doloremque nulla voluptatibus vero, hic magnam aliquid animi, nobis, perspiciatis voluptatem dolore. Pariatur asperiores et, ut soluta praesentium provident!</p> | |
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Praesentium quibusdam iure, non ut optio beatae adipisci ex a numquam consectetur eum! Ut, perferendis, culpa. Iusto quaerat id magni, cumque enim.</p> | |
</div><!-- .entry-content --> | |
<footer class="entry-footer"> | |
<span class="cat-links"> | |
<span class="screen-reader-text">Categorie</span> | |
<a href="#" rel="category tag">Cat1</a> | |
<a href="#" rel="category tag">Cat2</a> | |
</span> | |
<span class="tags-links"> | |
<span class="screen-reader-text">Etichette</span> | |
<a href="#" rel="tag">Tag1</a> | |
<a href="#" rel="tag">Tag2</a> | |
</span> | |
</footer><!-- .entry-footer --> | |
</article> | |
</main> | |
</div><!-- #primary --> | |
<aside id="secondary" class="widget-area" role="complementary"> | |
<div class="widget"></div> | |
<div class="widget"></div> | |
<div class="widget"></div> | |
</aside><!-- #secondary --> | |
</div><!-- #content --> | |
<footer id="colophon" class="site-footer" role="contentinfo"> | |
<div class="site-info"> | |
</div> | |
</footer> | |
</div><!-- .site --> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment