Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Integrated UIKit 3 styles and JavaScript. Added default header and custom menu. Added footer and custom settings for organization name and copyright date. Minor typos.
  • Loading branch information
apzeero committed Apr 29, 2019
1 parent 4571141 commit 8856099
Show file tree
Hide file tree
Showing 9 changed files with 12,070 additions and 1,695 deletions.
34 changes: 21 additions & 13 deletions footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,32 @@
* @package TeamWPUGPHTheme
*/

$org_name = get_option('teamwpugph_org_name', '');
$org_year = get_option('teamwpugph_org_year', '');

?>
</main>
<!-- #main-content -->

<footer id="colophon" class="site-footer">
<div class="site-info">
<a href="<?php echo esc_url( __( 'https://wordpress.org/', '_s' ) ); ?>"><?php
/* translators: %s: CMS name, i.e. WordPress. */
printf( esc_html__( 'Proudly powered by %s', 'teamwpugph' ), 'WordPress' );
?></a>
<span class="sep"> | </span>
<?php
<footer id="colophon" class="site-footer uk-section uk-section-default uk-section-small">
<div class="uk-container">
<p class="uk-text-small uk-text-center">
<?php printf(esc_html__('Copyright &copy; %s&ndash;%s %s', 'teamwpugph'), esc_html__($org_year, 'teamwpugph'), date("Y"), esc_html__($org_name, 'teamwpugph')); ?>
<a href="<?php echo esc_url(__('https://wordpress.org/', '_s')); ?>"><?php
/* translators: %s: CMS name, i.e. WordPress. */
printf(esc_html__('Proudly powered by %s', 'teamwpugph'), 'WordPress');
?></a>
<span class="sep">&emsp;|&emsp;</span>
<?php
/* translators: 1: Theme name, 2: Theme author. */
printf( esc_html__( 'Theme: %s', 'teamwpugph' ), '<a href="https://github.com/WordPress/gutenberg-starter-theme/">Gutenberg</a>' );
?>
</div><!-- .site-info -->
printf(esc_html__('Theme: %s', 'teamwpugph'), '<a href=" . TEAMWPUGPH_HOMEPAGE . ">' . TEAMWPUGPH_TEAMNAME . '</a>');
?>
</p>
</div>
</footer><!-- #colophon -->
</div><!-- #page -->

<?php wp_footer(); ?>

</body>
</html>

</html>
32 changes: 24 additions & 8 deletions functions.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<?php
/**
* teamwpugph functions and definitions
* TeamWPUGPH functions and definitions
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package TeamWPUGPHTheme
*/

require get_template_directory() . '/inc/defines.php';
require get_template_directory() . '/inc/custom-settings.php';

if ( ! function_exists( 'teamwpugph_setup' ) ) :
/**
* Sets up theme defaults and registers support for various WordPress features.
Expand Down Expand Up @@ -161,26 +164,39 @@ function teamwpugph_fonts_url() {
* Enqueue scripts and styles.
*/
function teamwpugph_scripts() {
wp_enqueue_style( 'gutenbergbase-style', get_stylesheet_uri() );

wp_enqueue_style( 'teamwpugphblocks-style', get_template_directory_uri() . '/css/blocks.css' );
if (defined('WP_DEBUG') && true === WP_DEBUG) {

wp_enqueue_style( 'teamwpugph-fonts', teamwpugph_fonts_url() );
$mainstyles = '/style.css';
$blockstyles = '/css/blocks.css';

$uikitjs = '/lib/uikit/dist/uikit.js';
$uikiticonsjs = '/lib/uikit/dist/uikit-icons.js';

} else {

wp_enqueue_script( 'teamwpugph-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20151215', true );
$mainstyles = '/style.min.css';
$blockstyles = '/css/blocks.css';

wp_enqueue_script( 'teamwpugph-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true );
$uikitjs = '/lib/uikit/dist/js/uikit.min.js';
$uikiticonsjs = '/lib/uikit/dist/js/uikit-icons.min.js';

if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}

wp_enqueue_style( 'teamwpugph-style', get_stylesheet_directory_uri() . $mainstyles );
wp_enqueue_style( 'teamwpugph-blocks-style', get_stylesheet_directory_uri() . $blockstyles );
wp_enqueue_style( 'teamwpugph-fonts', teamwpugph_fonts_url() );

wp_enqueue_script( 'uikit', get_stylesheet_directory_uri() . $uikitjs, array(), '3.1.2', false );
wp_enqueue_script( 'uikit-icons', get_stylesheet_directory_uri() . $uikiticonsjs, array(), '3.1.2', false );
}
add_action( 'wp_enqueue_scripts', 'teamwpugph_scripts' );

/**
* Implement the Custom Header feature.
*/
require get_template_directory() . '/inc/custom-header.php';
require get_template_directory() . '/inc/custom-menu.php';

/**
* Custom template tags for this theme.
Expand Down
76 changes: 47 additions & 29 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @package TeamWPUGPHTheme
*/
?>
<!doctype html>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
Expand All @@ -20,33 +20,51 @@
</head>

<body <?php body_class(); ?>>
<div id="page" class="site">
<a class="skip-link screen-reader-text" href="#primary"><?php esc_html_e( 'Skip to content', 'teamwpugph' ); ?></a>
<header id="masthead" class="site-header">
<div class="site-branding">
<?php
the_custom_logo();
if ( is_front_page() && is_home() ) : ?>
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
<?php else : ?>
<p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
<?php
endif;

$description = get_bloginfo( 'description', 'display' );
if ( $description || is_customize_preview() ) : ?>
<p class="site-description"><?php echo $description; /* WPCS: xss ok. */ ?></p>
<?php
endif; ?>
</div><!-- .site-branding -->
<a class="uk-invisible" href="#main-content" aria-hidden="false"><?php esc_html_e( 'Skip to content', 'teamwpugph' ); ?></a>

<nav id="site-navigation" class="main-navigation">
<button class="menu-toggle" aria-controls="primary-menu" aria-expanded="false"><?php esc_html_e( 'Primary Menu', 'teamwpugph' ); ?></button>
<?php
wp_nav_menu( array(
'theme_location' => 'menu-1',
'menu_id' => 'primary-menu',
) );
?>
</nav><!-- #site-navigation -->
</header><!-- #masthead -->
<!--HEADER-->
<header data-uk-sticky="sel-target: .uk-navbar-container; cls-active: uk-navbar-sticky; bottom: #transparent-sticky-navbar">
<div class="uk-container">
<nav class="uk-navbar-container uk-navbar-transparent" data-uk-navbar>
<div class="uk-navbar-left">
<a class="uk-navbar-item uk-logo" href="<?php echo home_url(); ?>">
<?php echo the_custom_logo(); ?>
</a>
</div>
<?php
wp_nav_menu( array(
'container_class' => 'uk-navbar-center',
'menu_class' => 'uk-navbar-nav',
'items_wrap' => '<ul class="%2$s">%3$s</ul>',
'walker' => new UIKit3_Walker_Nav_Menu(),
) );
?>
<div class="uk-navbar-right">
<ul class="uk-navbar-nav">
<li>
<a href="#" data-uk-icon="icon:user"></a>
<div class="uk-navbar-dropdown uk-navbar-dropdown-bottom-left">
<ul class="uk-nav uk-navbar-dropdown-nav">
<li class="uk-nav-header uk-text-small uk-text-primary">YOUR ACCOUNT</li>
<li><a href="#"><span data-uk-icon="icon: info"></span> Summary</a></li>
<li><a href="#"><span data-uk-icon="icon: refresh"></span> Edit</a></li>
<li><a href="#"><span data-uk-icon="icon: settings"></span> Configuration</a></li>
<li class="uk-nav-divider"></li>
<li><a href="#"><span data-uk-icon="icon: image"></span> Your Pictures</a></li>
<li class="uk-nav-divider"></li>
<li><a href="#"><span data-uk-icon="icon: sign-out"></span> Logout</a></li>

</ul>
</div>
</li>
<li class="uk-hidden@m"><a class="uk-navbar-toggle" data-uk-toggle data-uk-navbar-toggle-icon href="#offcanvas-nav"></a></li>
</ul>
</div>
</nav>
</div>
</header>
<!--/HEADER-->

<main id="main-content">

141 changes: 141 additions & 0 deletions inc/custom-menu.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
<?php

/**
* UIKit3_Walker_Nav_Menu Class for custom UIKit navbars
*
* @package TeamWPUGPHTheme
* @access public
*/
class UIKit3_Walker_Nav_Menu extends Walker_Nav_Menu
{
/**
* Starts the list before the elements are added. Note: used for children elements,
* not called on first level.
*
* @param string $output Passed by reference. Used to append additional content.
* @param int $depth Depth of menu item. Used for padding.
* @param array $args An array of arguments. @see wp_nav_menu()
* @return void
*/
public function start_lvl( &$output, $depth = 0, $args = array() )
{
if ( isset($args->item_spacing) && 'discard' === $args->item_spacing ) {
$t = '';
$n = '';
} else {
$t = "\t";
$n = "\n";
}
$indent = str_repeat( $t, $depth );

$output .= $indent . '<div class="uk-navbar-dropdown">' . "\n";
$output .= $indent . "\t" . '<ul class="uk-nav uk-navbar-dropdown-nav">' . "\n";
}

/**
* Ends the list of after the elements are added.
*
* @param string $output Used to append additional content (passed by reference).
* @param int $depth Depth of the item.
* @param array $args An array of additional arguments.
* @return void
*/
public function end_lvl(&$output, $depth = 0, $args = array())
{
if (isset($args->item_spacing) && 'discard' === $args->item_spacing) {
$t = '';
$n = '';
} else {
$t = "\t";
$n = "\n";
}
$indent = str_repeat($t, $depth);

$output .= $indent . "\t" . '</ul>' . "\n";
$output .= $indent . '</div>' . "\n";
}

/**
* Displays start of an element. E.g '<li> Item Name'
*
* @param string $output Used to append additional content (passed by reference).
* @param WP_Post $item Menu item data object.
* @param int $depth Depth of menu item. Used for padding.
* @param stdClass $args An object of wp_nav_menu() arguments.
* @param int $id Current item ID.
* @see Walker::start_el()
*/
//
function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
{

if ( isset( $args->item_spacing ) && 'discard' === $args->item_spacing ) {
$t = '';
$n = '';
} else {
$t = "\t";
$n = "\n";
}
$indent = ( $depth ) ? str_repeat( $t, $depth ) : '';

$object = $item->object;
$type = $item->type;
$title = $item->title;
$description = $item->description;
$permalink = $item->url;

$classes = empty( $item->classes ) ? array() : (array) $item->classes;
$classes[] = 'menu-item-' . $item->ID;

foreach ($classes as &$class) {
switch ($class) {
case 'current-menu-item':
case 'current-page-item':
case 'current-menu-parent':
case 'current-menu-ancestor':
$classes[] = 'uk-active';
break;
default:
break;
}
}

$item_output .= '<li class="' . implode(' ', $classes) . '">';

//Add SPAN if no Permalink
if ($permalink && $permalink != '#') {
$item_output .= '<a href="' . $permalink . '">';
} else {
$item_output .= '<span>';
}
$item_output .= $title;

// @todo: UIKit 3 navbar subtitle, @see https://getuikit.com/docs/navbar#subtitle
if ($description != '' && $depth == 0) {
$item_output .= '<small class="description">' . $description . '</small>';
}

// Close Permalink or span
if ($permalink && $permalink != '#') {
$item_output .= '</a>';
} else {
$item_output .= '</span>';
}

/**
* Filters a menu item's starting output.
*
* The menu item's starting output only includes `$args->before`, the opening `<a>`,
* the menu item's title, the closing `</a>`, and `$args->after`. Currently, there is
* no filter for modifying the opening and closing `<li>` for a menu item.
*
* @since 3.0.0
*
* @param string $item_output The menu item's starting HTML output.
* @param WP_Post $item Menu item data object.
* @param int $depth Depth of menu item. Used for padding.
* @param stdClass $args An object of wp_nav_menu() arguments.
*/
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
}
}
Loading

0 comments on commit 8856099

Please sign in to comment.