commit eec53627170d01dab321835e5fba1958fda783a8 Author: Aaron Yarborough <personal.ajy@gmail.com> Date: Mon Dec 17 16:30:35 2018 +0000 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3b181ec --- /dev/null +++ b/.gitignore @@ -0,0 +1,19 @@ +*.log +wp-config.php +wp-content/advanced-cache.php +wp-content/backup-db/ +wp-content/backups/ +wp-content/blogs.dir/ +wp-content/cache/ +wp-content/upgrade/ +wp-content/uploads/ +wp-content/mu-plugins/ +wp-content/wp-cache-config.php +wp-content/plugins/hello.php + +/.htaccess +/license.txt +/readme.html +/sitemap.xml +/sitemap.xml.gz + diff --git a/README.md b/README.md new file mode 100644 index 0000000..52dbf5d --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +graal-archive diff --git a/comments.php b/comments.php new file mode 100644 index 0000000..c365ebe --- /dev/null +++ b/comments.php @@ -0,0 +1,48 @@ +<?php + +if (post_password_required()) + return; +?> + +<div id="comments" class="comments-area"> + <?php if (have_comments()) : ?> + <h2 class="comments-title"> + <?php + printf( + _nx('One thought on "%2$s"', '%1$s thoughts on "%2$s"', get_comments_number(), 'comments title', 'garchive'), + number_format_i18n(get_comments_number()), + '<span>' . get_the_title() . '</span>' + ); + ?> + </h2> + + <ol class="comment-list"> + <?php + wp_list_comments(array( + 'style' => 'ul', + 'short_ping' => true, + 'avatar_size' => 30, + )); + ?> + </ol><!-- .comment-list --> + + <?php + // Are there comments to navigate through? + if (get_comment_pages_count() > 1 && get_option('page_comments')) : + ?> + <nav class="navigation comment-navigation" role="navigation"> + <h1 class="screen-reader-text section-heading"><?php _e('Comment navigation', 'garchive'); ?></h1> + <div class="nav-previous"><?php previous_comments_link(__('← Older Comments', 'garchive')); ?></div> + <div class="nav-next"><?php next_comments_link(__('Newer Comments →', 'garchive')); ?></div> + </nav><!-- .comment-navigation --> + <?php endif; // Check for comment navigation ?> + + <?php if (!comments_open() && get_comments_number()) : ?> + <p class="no-comments"><?php _e('Comments are closed.', 'garchive'); ?></p> + <?php endif; ?> + + <?php endif; // have_comments() ?> + + <?php comment_form(); ?> + +</div><!-- #comments --> \ No newline at end of file diff --git a/footer.php b/footer.php new file mode 100644 index 0000000..80a236a --- /dev/null +++ b/footer.php @@ -0,0 +1,18 @@ +<footer class="gar-footer"> + <div class="container"> + <div class="row text-center"> + <div class="col-sm-12"> + <p><strong>Information</strong></p> + <p>If you wish to use any of the content on this site for your project, please consider crediting the original authors in some way.</p> + + <p style="font-size: 12px"> + Site by Aaron Yarborough <br/> + <a href="mailto:me@aaronjy.me">Contact me</a> + </p> + </div> + </div> + </div> +</footer> + +</body> +</html> \ No newline at end of file diff --git a/functions.php b/functions.php new file mode 100644 index 0000000..b4d43d6 --- /dev/null +++ b/functions.php @@ -0,0 +1,33 @@ +<?php + + +add_action('after_setup_theme', function () { + +}); + +add_action('wp_enqueue_scripts', function () { + wp_enqueue_style('garchive-font-primary', 'https://fonts.googleapis.com/css?family=Montserrat:400,500,600', array(), null); + wp_enqueue_style('garchive-font-secondary', 'https://fonts.googleapis.com/css?family=Bitter:400,700', array(), null); + + wp_enqueue_script('garchive-jquery', 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js', array(), null); + wp_enqueue_style('garchive-fa', 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css', array(), null); + wp_enqueue_style('garchive-bootstrap-4-style', 'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css', array(), null); + wp_enqueue_script('garchive-bootstrap-4-script', 'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/js/bootstrap.min.js', array(), null); + wp_enqueue_script('garchive-masonry', 'https://cdnjs.cloudflare.com/ajax/libs/masonry/4.2.2/masonry.pkgd.min.js', array(), null); + + wp_enqueue_style('garchive-style', get_stylesheet_uri(), array(), filemtime(get_template_directory() . '/style.css')); + wp_enqueue_script('garchive-main', get_template_directory_uri() . '/scripts/main.js', array(), 3); +}); + +add_filter('show_admin_bar', '__return_false'); + +add_filter('excerpt_length', function() { + return 40; +}); + +add_filter('excerpt_more', function() { + return '…'; +}); + +require_once 'helpers.php'; +include 'metabox.php'; \ No newline at end of file diff --git a/header.php b/header.php new file mode 100644 index 0000000..021e857 --- /dev/null +++ b/header.php @@ -0,0 +1,54 @@ +<!DOCTYPE html> +<html <?php language_attributes(); ?>> + +<head> + <meta charset="<?php bloginfo('charset'); ?>"/> + <meta name="viewport" content="width=device-width, initial-scale=1"/> + <meta name="description" content="A collection of scripts and other content made by Graal Online players"/> + <title>G-Archive - Graal's player-made content archive</title> + <?php wp_head() ?> +</head> + +<body <?php body_class(); ?>> +<div id="search"> + <div class="container"> + <form action="<?php echo esc_url(home_url('/')); ?>"> + <div class="row"> + <div class="col-12 col-sm-8 col-md-10"> + <input type="text" name="s" id="searchBox" placeholder="Type your query here..." /> + </div> + <div class="col-12 col-sm-4 col-md-2"> + <button id="searchBtn" type="submit"> + <span class="fa fa-search"></span> Search + </button> + </div> + </div> + </form> + </div> +</div> +<div class="container"> + <header class="gar-header"> + <div class="row"> + <div class="col-sm-12 text-center"> + <span class="gar-header-title"> + <a href="<?php echo esc_url(home_url('/')) ?>"><?php echo get_bloginfo('name'); ?></a> + </span> + </div> + <div class="col-sm-12"> + <div class="text-center"> + <nav> + <ul class="gar-list-flat gar-header-nav"> + <li><a href="<?php echo esc_url(home_url('/category/scripts')) ?>">Scripts</a></li> + <li><a href="<?php echo esc_url(home_url('/category/server-backups')) ?>">Backups</a></li> + <li><a href="<?php echo esc_url(home_url('/category/tools')) ?>">Tools</a></li> + <li><a href="<?php echo esc_url(home_url('/category/levels')) ?>">Other</a></li> + <li><a href="#" data-toggle="search"><span class="fa fa-search"></span></a></li> + </ul> + </nav> + </div> + </div> + </div> + </header> +</div> + + \ No newline at end of file diff --git a/helpers.php b/helpers.php new file mode 100644 index 0000000..d472973 --- /dev/null +++ b/helpers.php @@ -0,0 +1,20 @@ +<?php + + +class GarchiveHelpers +{ + public static function get_creators() + { + if (!function_exists('rwmb_meta')) + return null; + + return rwmb_meta('garchive_metabox_creators'); + } + + public static function get_source() { + if (!function_exists('rwmb_meta')) + return null; + + return rwmb_meta('garchive_metabox_source'); + } +} \ No newline at end of file diff --git a/index.php b/index.php new file mode 100644 index 0000000..0fafc57 --- /dev/null +++ b/index.php @@ -0,0 +1,30 @@ +<?php get_header() ?> + +<div class="container"> + <div id="postGrid"> + <?php if (have_posts()): ?> + <?php while (have_posts()): the_post() ?> + <div class="gar-post-box"> + <a href="<?php the_permalink() ?>"> + <h3 class="gar-post-box-title"><?php the_title() ?></h3> + </a> + <div class="gar-post-box-excerpt"><?php the_excerpt() ?></div> + <?php + $creators = GarchiveHelpers::get_creators(); + ?> + <?php if ($creators): ?> + <div class="gar-post-box-author"><i class="fa fa-paint-brush" data-toggle="tooltip" title="Creators"></i> <?php echo $creators ?></div> + <?php endif; ?> + <div class="gar-post-box-category"><?php the_category(', ') ?></div> + </div> + <?php endwhile; ?> + <?php else: ?> + <div class="text-center"> + <h1>Uhhh...</h1> + <p>There are no posts to show right now! Check back later.</p> + </div> + <?php endif; ?> + </div> +</div> + +<?php get_footer() ?> \ No newline at end of file diff --git a/metabox.php b/metabox.php new file mode 100644 index 0000000..66880b3 --- /dev/null +++ b/metabox.php @@ -0,0 +1,31 @@ +<?php + +add_filter('rwmb_meta_boxes', function ($meta_boxes) { + $prefix = 'garchive_metabox_'; + $meta_boxes[] = array( + 'id' => 'extra_post_options', + 'title' => __('Extra Post Options', 'garchive'), + 'post_types' => array('post'), + 'context' => 'normal', + 'priority' => 'high', + 'autosave' => 'false', + 'fields' => array( + array( + 'id' => $prefix . 'creators', + 'type' => 'textarea', + 'name' => __('Creators', 'garchive'), + 'description' => __('A list of creators invovled in making the content.', 'garchive') + ), + array( + 'id' => $prefix . 'source', + 'type' => 'text', + 'name' => __('Source', 'garchive'), + 'description' => __('A link to the original content source.', 'garchive') + ) + ) + ); + + return $meta_boxes; +}); + +?> \ No newline at end of file diff --git a/scripts/main.js b/scripts/main.js new file mode 100644 index 0000000..55a0ea9 --- /dev/null +++ b/scripts/main.js @@ -0,0 +1,37 @@ +(function($) { + var postGrid, + search, + searchbox; + + $(document).ready(function() { + postGrid = $('#postGrid'); + search = $('#search'); + searchbox = $('#searchBox') + + initPostGrid(postGrid, '.gar-post-box'); + initSearch('a[data-toggle=search]', search, searchbox); + }); + + function initSearch(toggleSelector, search, searchbox) { + $(toggleSelector).click(function(e) { + e.preventDefault(); + + search.toggleClass('open'); + if (search.hasClass('open')) { + searchbox.focus(); + } + }); + } + + function initPostGrid(grid, itemSelector) { + // Don't init masonry if there are no items + if (!$(itemSelector).length) + return; + + grid.masonry({ + itemSelector: itemSelector, + percentPosition: true, + gutter: 20 + }); + } +})(jQuery); \ No newline at end of file diff --git a/single.php b/single.php new file mode 100644 index 0000000..e237d6e --- /dev/null +++ b/single.php @@ -0,0 +1,31 @@ +<?php get_header() ?> + +<div class="container"> + <?php while ( have_posts() ) : the_post(); ?> + <h1><?php the_title() ?></h1> + + <?php + $creators = GarchiveHelpers::get_creators(); + $source = GarchiveHelpers::get_source(); + ?> + + <div class="gar-post-subtitle"> + <?php if ($creators): ?> + <p><i class="fa fa-paint-brush" data-toggle="tooltip" title="Creators"></i> <?php echo $creators ?></p> + <?php endif; ?> + + <?php if ($source): ?> + <p><i class="fa fa-link" data-toggle="tooltip" title="Source"></i> <a href="<?php echo $source ?>"><?php echo $source ?></a></p> + <?php endif; ?> + </div> + + <hr/> + + <?php the_content(); ?> + + <hr /> + <?php comments_template() ?> + <?php endwhile; ?> +</div> + +<?php get_footer() ?> \ No newline at end of file diff --git a/style.css b/style.css new file mode 100644 index 0000000..b3e712b --- /dev/null +++ b/style.css @@ -0,0 +1,186 @@ +/* +Theme Name: gArchive +Author: Aaron Yarborough +Author URI: http://aaronjy.me +Description: Theme for gArchive +Version: 2 +Text Domain: garchive +*/ + +h1, +h2, +h3, +h4, +h5, +h6 { + font-family: 'Bitter', serif; +} + +html, +body { + font-family: 'Montserrat', sans-serif; +} + +a { + color: rgb(25, 145, 99); + font-weight: bold; + transition: .3s color; + text-decoration: none !important; +} + +a:hover { + color: rgb(34, 211, 143); +} + +.gar-list-flat { + margin: 0; + padding: 0; + list-style: none; +} + +.gar-list-flat li { + display: inline-block; +} + +.gar-header-title { + font-size: 40px; + font-family: 'Bitter', serif; + font-weight: 600; +} + +.gar-header-title a { + color: #111; +} + +.gar-header-nav { + margin: 20px 0; +} + +.gar-header-nav li { + margin: 0 10px; +} + +#postGrid .gar-post-box { + width: calc(50% - 10px); + margin-bottom: 20px; + display: inline-block; +} + +.gar-post-box { + padding: 15px; +} + +.gar-post-box-author { + color: #888; +} + +.gar-header { + margin-top: 30px; + margin-bottom: 40px; +} + +.gar-footer { + margin-top: 40px; + padding: 20px 0; + background-color: #111; + color: #fff !important; +} + +.gar-post-subtitle { + color: #777; + margin-top: 20px; +} + +.gar-post-subtitle p { + margin-bottom: 5px; +} + +.gar-post-box-category a { + font-weight: 400; + font-size: 14px; +} + +.comments-title { + font-size: 20px; + margin-bottom: 20px; +} + +.commentlist { + list-style: none; + padding: 0; +} + +.commentlist .comment { + margin-bottom: 20px; +} + +.comment-form-comment>label { + display: block; +} + +.single h2 { + margin-top: 40px; + margin-bottom: 25px; +} + +.wp-block-code { + max-height: 500px; +} + +pre { + font-size: 72.5%; +} + +#search { + width: 100%; + height: 100px; + padding: 30px; + display: flex; + align-items: center; + position: relative; + margin-top: -100px; + transition: 0.5s margin-top; +} + +#search.open { + margin-top: 0; +} + +#searchBox { + width: 100%; + height: 100%; + box-sizing: border-box; + border: none; + border-bottom: 1px solid #111; + background-color: #fff; +} + +#searchBtn { + width: 100%; + height: 100%; + font-family: 'Montserrat', sans-serif; + font-size: 15px; + font-weight: bold; + border: 0; + padding: 8px; + color: #fff; + background-color: #111; +} + +#comment { + max-width: 100%; +} + +@media only screen and (max-width: 767px) { + #postGrid .gar-post-box { + width: 100%; + margin-bottom: 20px; + } +} + +@media only screen and (max-width: 575px) { + #searchBox { + padding: 5px; + margin-bottom: 5px; + } +} \ No newline at end of file diff --git a/template-homepage.php b/template-homepage.php new file mode 100644 index 0000000..c8acea4 --- /dev/null +++ b/template-homepage.php @@ -0,0 +1,41 @@ +<?php + /** + * Template Name: Homepage + */ +?> + +<?php + + $posts = new WP_Query(array( + 'posts_per_page' => -1, + 'post_type' => 'post' + )); + +?> + +<?php get_header() ?> + +<div class="container"> + <div id="postGrid"> + <?php if ($posts): while ($posts->have_posts()): $posts->the_post() ?> + <div class="gar-post-box"> + <a href="<?php the_permalink() ?>"> + <h3 class="gar-post-box-title"><?php the_title() ?></h3> + </a> + <div class="gar-post-box-excerpt"><?php the_excerpt() ?></div> + + <?php + $creators = GarchiveHelpers::get_creators(); + ?> + <?php if ($creators): ?> + <div class="gar-post-box-author"><i class="fa fa-paint-brush" data-toggle="tooltip" title="Creators"></i> <?php echo $creators ?></div> + <?php endif; ?> + + <div class="gar-post-box-category"><?php the_category(', ') ?></div> + </div> + <?php endwhile; endif; ?> + </div> +</div> + + +<?php get_footer() ?> \ No newline at end of file