updated file structures and HTML, added archive, single, page for better view control. updated labeling.

This commit is contained in:
Jacob Haddon 2024-02-18 15:05:34 -05:00
parent ae204a9d35
commit e6c111ace9
10 changed files with 257 additions and 47 deletions

122
archive.php Normal file
View File

@ -0,0 +1,122 @@
<?php
// MFWPT - archive.php
// function arl_kottke_archives GPL2.0, attribution below
?>
<?php
get_header();
if ( have_posts() ) while ( have_posts() ) : the_post();
?>
<secion class="archives">
<?php
// if it is the month or category link
if (is_month() || is_category()) {
?>
<h1 class="archive-search-title"><a href="<?php the_permalink(); ?> "><?php the_title(); ?></a></h1>
<div class="archive-excerpt"><?php the_excerpt(); ?></div>
<?php
// else it should be the original text
} else {
?>
<h1 class="archive-post-title"><a href="<?php the_permalink(); ?> "><?php the_title(); ?></a></h1>
<div class="archive-content"><?php the_content(); ?></div>
<?php
} // if month or category
endwhile;
?>
<h2>Browse by date:</h2>
<?php arl_kottke_archives(); ?>
<h2>Browse by subject:</h2>
<ul class="archive-taxonomy"><?php wp_list_categories('title_li=');?></ul>
<h2>If all else fails, try searching for it&mdash;</h2>
<?php get_search_form(); ?>
</secion><!--archives-->
<?php
// endwhile; // end of the loop.
get_footer();
?>
<?php
/*
This function was originally a plugin, GPL2, information below:
Plugin Name: Kottke Style Archive
Version: 0.3
Plugin URI: http://www.lattimore.id.au/projects/wordpress/plugins/kottke-style-archives/
Author: Alistair Lattimore
Author URI: http://www.lattimore.id.au
Description: Displays an archive of posts in the same style to http://www.kottke.org/everfresh.
*/
function arl_kottke_archives($month_separator = ' ', $month_format = 'M')
{
global $wpdb;
$output = "";
$year = "";
$sql = "SELECT DATE_FORMAT(post_date, '%Y') AS Year, ";
$sql .= "DATE_FORMAT(post_date, '%m') AS Month ";
$sql .= "FROM $wpdb->posts ";
$sql .= "WHERE DATE_FORMAT(post_date, '%Y') <> '0000'";
$sql .= " AND post_status = 'publish'";
$sql .= " AND post_type = 'post' ";
$sql .= "GROUP BY DATE_FORMAT(post_date, '%Y'), DATE_FORMAT(post_date, '%m') ";
$sql .= "ORDER BY DATE_FORMAT(post_date, '%Y') DESC, DATE_FORMAT(post_date, '%m') ASC;";
$months = $wpdb->get_results($sql);
if (!empty($months))
{
foreach ($months as $month)
{
// Add in the year heading
if (($year == "") || ($year != $month->Year))
{
if (strlen($output))
{
$output .= "<br />\n<strong>" . $month->Year . ":</strong>&nbsp;";
}
else
{
$output .= "\n<strong>" . $month->Year . ":</strong>&nbsp;";
}
}
// Add in the monthly archive links
if ($year == $month->Year)
$output .= $month_separator;
$output .= '<a href="' . get_month_link($month->Year, $month->Month) . '">' . date($month_format, mktime(0, 0, 0, $month->Month, 1, $month->Year)) . '</a>';
$year = $month->Year;
}
}
else
{
$output = "<p>None available</p>\n";
}
print $output;
}
?>

View File

@ -1,14 +1,10 @@
<?php
/**
* The template for displaying Comments.
*
* The area of the page that contains comments and the comment form.
*
* @package WordPress
* @subpackage Twenty_Thirteen
* @since Twenty Thirteen 1.0
*/
// MFWPT - single.php
// uses code from Wordpress Twenty_Thirteen
?>
<?php
/*
* If the current post is protected by a password and the visitor has not yet
* entered the password we will return early without loading the comments.
@ -17,11 +13,10 @@ if ( post_password_required() )
return;
?>
<div id="comments" class="comments-area">
<section class="comments-area">
<?php if ( have_comments() ) : ?>
<h2 class="comments-title">Comments:
</h2>
<h2 class="comments-title">Comments:</h2>
<div class="comment-list">
<?php
@ -42,4 +37,4 @@ if ( post_password_required() )
<?php comment_form(); ?>
</div><!-- #comments -->
</section><!-- #comments-area -->

View File

@ -1,6 +1,6 @@
<?php
// MFWPT - content.php
// content.PHP
?>
<article id="post-<?php the_ID(); ?>" >
@ -11,13 +11,4 @@
<?php the_content(); ?>
</section><!-- /.blog-post -->
<section class="blog-comments">
<?php
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
?>
</section> <!-- blog comments -->
</article>

View File

@ -1,3 +1,8 @@
<?php
// MFWPT - footer.php
?>
<hr>
<footer>

View File

@ -1,8 +1,8 @@
<?php
// MFWPT - functions.php
// function file for mfwpt
// enqueue the stye
// to do: clean this up
function mytheme_enqueue_style() {
wp_enqueue_style( 'style', get_stylesheet_uri() );
@ -23,7 +23,10 @@ add_action( 'init', 'register_my_menus' );
// remove unused word press features from header
function remove_actions_parent_theme() {
function remove_actions_from_theme() {
// this removes a lot of the extras added in to <HEAD>
// it also probably breaks a lot of things
// remove_action('wp_head', 'rsd_link');
// remove_action('wp_head', 'wp_generator');
// remove_action('wp_head', 'feed_links', 2);
@ -38,7 +41,7 @@ function remove_actions_parent_theme() {
wp_dequeue_style( 'wc-block-style' );
wp_dequeue_style( 'global-styles' );
wp_dequeue_style( 'classic-theme-styles' );
wp_dequeue_style('core-block-supports');
remove_action( 'wp_head', '_wp_render_title_tag', 1);
// remove_action( 'wp_head', 'wp_enqueue_scripts', 1 );
@ -58,8 +61,11 @@ function remove_actions_parent_theme() {
remove_action( 'wp_head', 'wp_shortlink_wp_head', 10, 0);
remove_action( 'wp_head', 'wp_custom_css_cb', 101);
remove_action( 'wp_head', 'wp_site_icon', 99);
remove_action( 'wp_enqueue_scripts', 'wp_enqueue_global_styles' );
remove_action( 'wp_footer', 'wp_enqueue_global_styles', 1 );
remove_action( 'wp_body_open', 'wp_global_styles_render_svg_filters' );
} // remove_actions_parent_theme
add_action( 'wp_enqueue_scripts', 'remove_actions_parent_theme');
add_action( 'wp_enqueue_scripts', 'remove_actions_from_theme');
function disable_emojis() {
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
@ -74,4 +80,8 @@ function disable_emojis() {
} // disable_emojis
add_action( 'init', 'disable_emojis' );
add_action('wp_footer', function () {
wp_dequeue_style('core-block-supports');
});
?>

View File

@ -1,11 +1,16 @@
<!DOCTYPE html>
<?php
// MFWPT - header.php
?>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?php wp_title(); ?></title>
<title><?php bloginfo( 'name' ); ?></title>
<?php if ( is_singular() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' ); ?>
<?php wp_head(); ?>
@ -15,13 +20,17 @@
<body <?php body_class(); ?>>
<header>
<h1> <a href="<?php bloginfo( 'url' ); ?>"><?php bloginfo( 'name' ); ?></a> </h1>
<h2> <?php bloginfo( 'description' ); ?> </h2>
</header>
<!-- Nav -->
<?php wp_nav_menu( array(
'theme_location' => 'header-menu',
'container' => 'nav',
'container_class' => 'mfwpt_menu'
) );?>
<?php
wp_nav_menu( array(
'theme_location' => 'header-menu',
'container' => 'nav',
'container_class' => 'mfwpt_menu'
) );
?>
<!-- Nav -->

View File

@ -1,16 +1,30 @@
<?php
// MFWPT - index.php
// This is the index page, which presents the river,
// and is the default for any of the other views that
// do not have specific php views
?>
<?php get_header(); ?>
<main>
<?php
if ( have_posts() ) : while ( have_posts() ) : the_post();
<?php
if ( have_posts() ) : while ( have_posts() ) : the_post();
// get the content.php
get_template_part( 'content', get_post_format() );
endwhile;
else :
_e( 'Sorry, no posts matched your criteria.', 'textdomain' );
endif;
//get_sidebar();
?>
else :
_e( 'Sorry, no posts matched your criteria.', 'textdomain' );
endif;
// pagenation for the pages
the_posts_pagination( array(
'mid_size' => 2,
'prev_text' => "<-- ",
'next_text' => " -->"
) );
//get_sidebar();
?>
</main>

30
page.php Normal file
View File

@ -0,0 +1,30 @@
<?php
// MFWPT - page.php
?>
<?php get_header(); ?>
<main>
<?php
// start the loop, check for posts
if ( have_posts() ) : while ( have_posts() ) : the_post();
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php the_content(); ?>
</article><!-- page -->
<?php
endwhile;
else :
_e( 'Sorry, no posts matched your criteria.', 'textdomain' );
endif;
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
?>
</main>
<?php get_footer(); ?>

34
single.php Normal file
View File

@ -0,0 +1,34 @@
<?php
// MFWPT - single.php
?>
<?php get_header(); ?>
<main>
<?php
// start the loop, check for posts
if ( have_posts() ) : while ( have_posts() ) : the_post();
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<h2 class="blog-post-title"><a href="<?php the_permalink(); ?> "><?php the_title(); ?></a></h2>
<p class="blog-post-meta"><?php the_date(); ?> by <?php the_author_link(); ?></p>
<?php get_the_author_link(); ?>
<?php the_content(); ?>
</article><!-- blog post -->
<?php
endwhile;
else :
_e( 'Sorry, no posts matched your criteria.', 'textdomain' );
endif;
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
?>
</main>
<?php get_footer(); ?>

View File

@ -1,15 +1,15 @@
/*
Theme Name: Motherfucking Wordpress Theme
Theme URI: https://jacobhaddon.com/mfwpt
Theme URI: https://code.jacobhaddon.com/Wordpress/mfwpt
Author: Jacob Haddon
Author URI: https://jacobhaddon.com
Description: A no frills, fast loading site that works.
Description: A no frills, fast loading Wordpress theme
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: mfwpt
Tags:
This theme, like WordPress, is licensed under the GPL.
This theme, like WordPress, is licensed under the GPLv2.0.
This theme, like motherfuckingwebsite.com is satire
Use it to make something cool, have fun, and share what you've learned with others.
*/