This commit is contained in:
Kiara Grouwstra 2023-10-16 22:26:57 +02:00
commit b63a34b8d9
20 changed files with 320 additions and 0 deletions

16
src/404.php Normal file
View File

@ -0,0 +1,16 @@
<?php get_header(); ?>
<!-- container -->
<div class="container">
<div id="primary" class="not-found">
<section class="error-404 not-found">
<h1 class="page-title"><?php _e( 'Oops! That page can&rsquo;t be found.', 'simple-campaign' ); ?></h1>
<div class="page-content">
<p><?php _e( 'It looks like nothing was found at this location. Maybe try a search?', 'simple-campaign' ); ?></p>
<?php get_search_form(); ?>
</div>
</section>
</div>
</div>
<!-- /container -->
<?php get_footer(); ?>

15
src/content-none.php Normal file
View File

@ -0,0 +1,15 @@
<section class="no-results">
<h1 class="page-title"><?php _e( 'Nothing Found', 'simple-campaign' ); ?></h1>
<div class="inner-content">
<?php if ( is_home() && current_user_can( 'publish_posts' ) ) : ?>
<p><?php printf( __( 'Ready to publish your first post? <a href="%1$s">Get started here</a>.', 'simple-campaign' ), esc_url( admin_url( 'post-new.php' ) ) ); ?></p>
<?php elseif ( is_search() ) : ?>
<p><?php _e( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'simple-campaign' ); ?></p>
<?php get_search_form(); ?>
<?php else : ?>
<p><?php _e( 'It seems we can&rsquo;t find what you&rsquo;re looking for. Perhaps searching can help.', 'simple-campaign' ); ?></p>
<?php get_search_form(); ?>
<?php endif; ?>
</div>
</section>
</div>

38
src/content-page.php Normal file
View File

@ -0,0 +1,38 @@
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
</header><!-- .entry-header -->
<div class="entry-content">
<?php
the_content();
wp_link_pages( array(
'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'simple-campaign' ),
'after' => '</div>',
) );
?>
</div><!-- .entry-content -->
<?php if ( get_edit_post_link() ) : ?>
<footer class="entry-footer">
<?php
edit_post_link(
sprintf(
wp_kses(
/* translators: %s: Name of current post. Only visible to screen readers */
__( 'Edit <span class="screen-reader-text">%s</span>', 'simple-campaign' ),
array(
'span' => array(
'class' => array(),
),
)
),
get_the_title()
),
'<span class="edit-link">',
'</span>'
);
?>
</footer><!-- .entry-footer -->
<?php endif; ?>
</article><!-- #post-<?php the_ID(); ?> -->

6
src/footer.php Normal file
View File

@ -0,0 +1,6 @@
</div><!-- #content -->
</div><!-- #page -->
<?php wp_footer(); ?>
</body>
</html>

11
src/front-page-footer.php Normal file
View File

@ -0,0 +1,11 @@
<?php
if ( ! is_active_sidebar( 'front-page-footer' ) ) {
return;
}
?>
<section class="front-page-footer">
<div class="content">
<?php dynamic_sidebar( 'front-page-footer' ); ?>
</div>
</section><!--.front-page-footer-->

140
src/functions.php Normal file
View File

@ -0,0 +1,140 @@
<?php
add_action( 'wp_enqueue_scripts', function() {
wp_enqueue_style( 'style', get_stylesheet_uri() );
wp_enqueue_script('jquery');
wp_enqueue_script( 'footer_js', get_template_directory_uri() . '/js/footer-bundle.js', null, 1.0, true );
});
add_filter( 'excerpt_length', function() {
return 22;
});
// Theme setup
add_action( 'after_setup_theme', function() {
// Handle Titles
add_theme_support( 'title-tag' );
// Add featured image support
add_theme_support( 'post-thumbnails' );
add_image_size( 'small-thumbnail', 720, 720, true );
add_image_size( 'square-thumbnail', 80, 80, true );
add_image_size( 'banner-image', 1024, 1024, true );
load_theme_textdomain( 'simple-campaign', get_template_directory() . '/languages' );
add_theme_support( 'post-thumbnails' );
register_nav_menus( array(
'menu-1' => esc_html__( 'Primary', 'simple_campaign' ),
) );
add_theme_support( 'html5', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
) );
add_theme_support( 'custom-background', apply_filters( 'simple_campaign_custom_background_args', array(
'default-color' => 'ffffff',
'default-image' => '',
) ) );
add_theme_support( 'customize-selective-refresh-widgets' );
add_theme_support( 'custom-logo', array(
'height' => 250,
'width' => 250,
'flex-width' => true,
'flex-height' => true,
) );
});
show_admin_bar( false );
// Checks if there are any posts in the results
function is_search_has_results() {
return 0 != $GLOBALS['wp_query']->found_posts;
}
add_action( 'after_setup_theme', function() {
$GLOBALS['content_width'] = apply_filters( 'simple_campaign_content_width', 640 );
}, 0);
add_action( 'widgets_init', function() {
register_sidebar( array(
'name' => esc_html__( 'Footer', 'simple_campaign' ),
'id' => 'sidebar-1',
'description' => esc_html__( 'Add widgets here.', 'simple_campaign' ),
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
) );
register_sidebar( array(
'name' => esc_html__( 'Home Pre-Footer', 'simple_campaign' ),
'id' => 'front-page-footer',
'description' => esc_html__( 'Add widgets here.', 'simple_campaign' ),
'before_widget' => '<div id="%1$s" class="widget column %2$s">',
'after_widget' => '</div>',
'before_title' => '<h2 class="column-title">',
'after_title' => '</h2>',
) );
});
// includes
require_once dirname(__FILE__).'/inc/index.php';
function ti_custom_javascript() {
?>
<script>
// prefill form inputs from query parameters (?input_name=value)
var params = new URLSearchParams(window.location.search);
for (var [param_key, param_value] of params.entries()) {
var formElement = document.getElementById(param_key);
if (formElement) {
if (['checkbox', 'radio'].includes(formElement.type)) {
formElement.checked = param_value;
} else {
formElement.value = param_value;
}
}
}
</script>
<?php
}
add_action('wp_footer', 'ti_custom_javascript');
// add minimum price on congress tickets for members
add_filter( 'gform_field_validation_19_9', 'gf_user_defined_price_validation_tickets_members', 10, 4 );
function gf_user_defined_price_validation_tickets_members( $result, $value, $form, $field ) {
//change value for price field to just be numeric (strips off currency symbol, etc.) using Gravity Forms to_number function
$number = GFCommon::to_number( $value, 'EUR' );
GFCommon::log_debug( __METHOD__ . '(): User Defined Price Submitted: ' . $number );
$min_amount = 1.00;
if ( $result['is_valid'] && $number < $min_amount ) {
$result['is_valid'] = false;
$result['message'] = 'Je kan geen bedrag invullen lager dan '.$min_amount.' euro.';
}
return $result;
}
// add minimum price on congress tickets for non-members
add_filter( 'gform_field_validation_19_20', 'gf_user_defined_price_validation_tickets_nonmembers', 10, 4 );
function gf_user_defined_price_validation_tickets_nonmembers( $result, $value, $form, $field ) {
//change value for price field to just be numeric (strips off currency symbol, etc.) using Gravity Forms to_number function
$number = GFCommon::to_number( $value, 'EUR' );
GFCommon::log_debug( __METHOD__ . '(): User Defined Price Submitted: ' . $number );
$min_amount = 15.00;
if ( $result['is_valid'] && $number < $min_amount ) {
$result['is_valid'] = false;
$result['message'] = 'Je kan geen bedrag invullen lager dan '.$min_amount.' euro.';
}
return $result;
}

23
src/header.php Normal file
View File

@ -0,0 +1,23 @@
<!doctype html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<div id="page" class="site">
<header id="masthead" class="site-header">
<div class="site-branding">
<p class="site-title">
<a href="https://www.bij1.org" rel="home">
<?php bloginfo( 'name' ); ?>
</a>
</p>
</div><!-- .site-branding -->
<div class="site-decoration">
</div><!-- .site-decoration -->
</header><!-- #masthead -->
<div id="content" class="site-content">

BIN
src/img/banner.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 388 KiB

BIN
src/img/banner.old.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 KiB

BIN
src/img/banner.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

BIN
src/img/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

13
src/inc/fonts.php Normal file
View File

@ -0,0 +1,13 @@
<?php
/*
Add the fonts stylesheet here. This can be a local or external stylesheet.
For multiple stylesheets copy and paste the wp_enqueue_style line and
also change the 'fonts' text to something else for every call
wp_enqueue_style('stylesheet-name','YOUR FONTS CSS URL HERE');
*/
add_action( 'wp_enqueue_scripts', function(){
wp_enqueue_style('fonts','https://use.typekit.net/oiy6sps.css');
});

5
src/inc/index.php Normal file
View File

@ -0,0 +1,5 @@
<?php
require_once dirname(__FILE__) . '/fonts.php';
require_once dirname(__FILE__) . '/read-more-toggle.php';
require_once dirname(__FILE__) . '/site-icons.php';

View File

@ -0,0 +1,7 @@
<?php
add_filter('the_content', function($content){
if( !strpos( $content, '<span id="more-' ) ) return $content;
$content = preg_replace('/<span id="more-([0-9]*)"><\/span>/', '<div class="entry-read-more">', $content);
return $content.'<span class="entry-read-more-toggle-wrap"><a href="#" class="entry-read-more-toggle">Lees meer</a></span></div>';
});

10
src/inc/site-icons.php Normal file
View File

@ -0,0 +1,10 @@
<?php
/* Replace everything between ?> and <?php with the icon code block and
make sure to upload the icons to the referenced location on the server. */
add_action('wp_head', function() {
?>
<link rel="icon" type="image/png" sizes="32x32" href="https://bureaubolster.nl/app/themes/tabula/favicons/favicon-32x32.png">
<?php
});

19
src/index.php Normal file
View File

@ -0,0 +1,19 @@
<?php get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main">
<?php
if ( have_posts() ) :
while ( have_posts() ) :
the_post();
get_template_part( 'content', get_post_type() );
endwhile;
else :
get_template_part( 'content', 'none' );
endif;
?>
</main><!-- #main -->
</div><!-- #primary -->
<?php
if (is_front_page()) get_template_part('front-page-footer');
get_sidebar();
get_footer();

1
src/js/footer-bundle.js Normal file
View File

@ -0,0 +1 @@
"use strict";!function(){var e=document.getElementsByClassName("page type-page")[0];if(e){var t=e.getElementsByClassName("entry-content")[0];if(t){var s=t.getElementsByClassName("gform_wrapper")[0];s?(e.classList.add("has-entry-form"),e.insertBefore(s,t)):e.classList.add("no-entry-form")}}}(),function(){var t,s;void 0!==(s=document.getElementsByClassName("entry-read-more")[0])&&(s.classList.add("closed"),void 0!==(t=s.getElementsByClassName("entry-read-more-toggle")[0])&&(t.onclick=function(e){e.preventDefault(),s.classList.contains("closed")?(s.classList.remove("closed"),t.textContent="Inklappen"):(s.classList.add("closed"),t.textContent="Lees meer")}))}();

0
src/languages/index.php Normal file
View File

11
src/sidebar.php Normal file
View File

@ -0,0 +1,11 @@
<?php
if ( ! is_active_sidebar( 'sidebar-1' ) ) {
return;
}
?>
<aside id="secondary" class="widget-area">
<div class="widgets">
<?php dynamic_sidebar( 'sidebar-1' ); ?>
</div>
</aside><!-- #secondary -->

5
src/style.css Normal file

File diff suppressed because one or more lines are too long