Last active
March 11, 2020 03:45
-
-
Save danielpataki/3daf60076c594afa6bb8 to your computer and use it in GitHub Desktop.
Basics Of Theme Development
This file contains 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
<h2><a href='<?php the_permalink() ?>'><?php the_title() ?></a></h2> | |
<div class="content"> | |
<?php the_excerpt() ?> | |
</div> |
This file contains 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 | |
add_action( 'wp_enqueue_scripts', 'mat_assets' ); | |
function mat_assets() { | |
wp_enqueue_style( 'my-awesome-theme', get_stylesheet_uri() ); | |
} |
This file contains 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
<!DOCTYPE html> | |
<html <?php language_attributes(); ?> class="no-js"> | |
<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"> | |
<?php wp_head(); ?> | |
</head> | |
<body <?php body_class(); ?>> | |
<div id="site-header"> | |
<h1><?php bloginfo('title') ?></h1> | |
</div> | |
<div id='site-content'> | |
This file contains 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
/* | |
Theme Name: My Awesome Theme | |
Theme URI: https://myawesometheme.awesome | |
Author: Daniel Pataki | |
Author URI: https://danielpataki.com | |
Description: The theme for my awesome site | |
Version: 1.0 | |
License: GNU General Public License v2 or later | |
License URI: http://www.gnu.org/licenses/gpl-2.0.html | |
Text Domain: my-awesome-theme | |
This theme, like WordPress, is licensed under the GPL. | |
Use it to make something cool, have fun, and share what you've learned with others. | |
*/ | |
html { | |
height: 100%; | |
background:#444; | |
font-family: "Helvetica Neue", Arial, sans-serif; | |
line-height: 1.5em; | |
} | |
#site-header { | |
text-align: center; | |
} | |
#site-header h1 { | |
font-size:32px; | |
color: #ffffff; | |
font-weight: 300; | |
letter-spacing: 1px; | |
} | |
#site-content { | |
max-width:625px; | |
background: #fff; | |
margin: 0 auto; | |
padding: 22px; | |
border-radius:5px; | |
} | |
#site-footer { | |
color: #fff; | |
text-align:center; | |
font-size:12px; | |
text-transform: uppercase; | |
} |
This file contains 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="article"> | |
<h2 class="article-title"><?php the_title() ?></h2> | |
<div class="article-content"><?php the_content() ?></div> | |
<div class="article-meta">Published on <?php the_time( "Y-m-d" ) ?> by <?php the_author() ?></div> | |
</div> | |
<?php get_sidebar() ?> | |
<?php get_footer() ?> |
This file contains 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
<!DOCTYPE html> | |
<html <?php language_attributes(); ?> class="no-js"> | |
<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"> | |
<?php wp_head(); ?> | |
</head> | |
<body <?php body_class(); ?>> | |
<div id="site-header"> | |
<h1><?php bloginfo('title') ?></h1> | |
</div> | |
<div id='site-container'> | |
<div id='site-content'> |
This file contains 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
<!DOCTYPE html> | |
<html <?php language_attributes(); ?> class="no-js"> | |
<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"> | |
<?php wp_head(); ?> | |
</head> | |
<body <?php body_class(); ?>> |
This file contains 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() ?> | |
<?php if( have_posts() ) : ?> | |
<?php while( have_posts() ) : the_post() ?> | |
<h2><a href='<?php the_permalink() ?>'><?php the_title() ?></a></h2> | |
<div class="content"> | |
<?php if( is_singular() ) : ?> | |
<?php the_content() ?> | |
<?php else : ?> | |
<?php the_excerpt() ?> | |
<?php endif ?> | |
</div> | |
<?php endwhile ?> | |
<?php else : ?> | |
<p>Oh No, there are no posts!</p> | |
<?php endif ?> | |
<?php get_footer() ?> |
This file contains 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() ?> | |
My Awesome Theme | |
<?php get_footer() ?> |
This file contains 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() ?> | |
<?php | |
if( have_posts() ) { | |
while( have_posts() ) { | |
the_post(); | |
get_template_part( 'template-parts/content', '' ); | |
} | |
} | |
else { | |
get_template_part( 'template-parts/content', 'none' ); | |
} | |
?> | |
<?php get_footer() ?> |
This file contains 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( have_posts() ) : ?> | |
<?php while( have_posts() ) : the_post() ?> | |
<h2><a href='<?php the_permalink() ?>'><?php the_title() ?></a></h2> | |
<div class="content"> | |
<?php the_content() ?> | |
</div> | |
<?php endwhile ?> | |
<?php else : ?> | |
<p>Oh No, there are no posts!</p> | |
<?php endif ?> |
This file contains 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() ?> | |
<?php if( have_posts() ) : ?> | |
<?php while( have_posts() ) : the_post() ?> | |
<h2><a href='<?php the_permalink() ?>'><?php the_title() ?></a></h2> | |
<div class="content"> | |
<?php the_content() ?> | |
</div> | |
<?php endwhile ?> | |
<?php else : ?> | |
<p>Oh No, there are no posts!</p> | |
<?php endif ?> | |
<?php get_footer() ?> |
This file contains 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
<body> | |
<div id="site-header"></div> | |
<div id='site-container'> | |
<div id='site-content'></div> | |
<div id='site-sidebar'></div> | |
</div> | |
</body> |
This file contains 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
#site-container { | |
max-width: 855px; | |
margin:0 auto; | |
} | |
#site-sidebar { | |
width:220px; | |
float:right; | |
padding: 22px; | |
border-radius:5px; | |
background: #fff; | |
} | |
#site-content { | |
float:left; | |
max-width:525px; | |
background: #fff; | |
padding: 22px; | |
border-radius:5px; | |
} | |
#site-footer { | |
clear:both; | |
color: #fff; | |
text-align:center; | |
font-size:12px; | |
text-transform: uppercase; | |
} |
This file contains 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
/* | |
Theme Name: My Awesome Theme | |
Theme URI: https://myawesometheme.awesome | |
Author: Daniel Pataki | |
Author URI: https://danielpataki.com | |
Description: The theme for my awesome site | |
Version: 1.0 | |
License: GNU General Public License v2 or later | |
License URI: http://www.gnu.org/licenses/gpl-2.0.html | |
Text Domain: my-awesome-theme | |
This theme, like WordPress, is licensed under the GPL. | |
Use it to make something cool, have fun, and share what you've learned with others. | |
*/ |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>A single post template</title> | |
</head> | |
<body> | |
<div id="site-header"> | |
<h1>Welcome to my site</h1> | |
<nav> | |
<ul> | |
<li><a href=''>Home</a></li> | |
<li><a href=''>About</a></li> | |
<li><a href=''>Contact</a></li> | |
</ul> | |
</nav> | |
</div> | |
<div id="article"> | |
<h2 class="article-title"><?php the_title() ?></h2> | |
<div class="article-content"><?php the_content() ?></div> | |
<div class="article-meta">Published on <?php the_time( "Y-m-d" ) ?> by <?php the_author() ?></div> | |
</div> | |
<div id="site-footer"> | |
<nav> | |
<ul> | |
<li><a href=''>Home</a></li> | |
<li><a href=''>About</a></li> | |
<li><a href=''>Contact</a></li> | |
</ul> | |
</nav> | |
<div id="copyright">© Daniel Pataki</div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment