Commit 4dbae0b5 authored by Petr Balga's avatar Petr Balga

Deleted all themes except for 2020, added custom post type

parent c51f549a
......@@ -61,404 +61,20 @@ add_filter('upload_mimes', 'add_file_types_to_uploads');
// Retrieves the attachment ID from the file URL
function chc_get_image_id($image_url) {
// if not in use delete
function custom_get_image_id($image_url) {
global $wpdb;
$attachment = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid='%s';", $image_url ));
return $attachment[0];
}
/* Admin appearance customizer screen */
function chc_administration_callout($wp_customize) {
$wp_customize->add_section('chc-landing-callout-section', array(
'title' => 'Úvodní obrázek'
));
/* Úvodní obrázek */
$wp_customize->add_setting('chc-landing-callout-image');
$wp_customize->add_control( new WP_Customize_Image_Control($wp_customize, 'chc-landing-callout-image-control', array(
'label' => 'Úvodní obrázek',
'section' => 'chc-landing-callout-section',
'settings' => 'chc-landing-callout-image'
)));
/* -------------------------------------------------------------------------------------------------------------- */
$wp_customize->add_section('chc-news-callout-section', array(
'title' => 'Sekce novinek (úvodní stránka)'
));
/* Headline */
$wp_customize->add_setting('chc-news-callout-headline', array(
'default' => 'Nadpis sekce novinek'
));
$wp_customize->add_control( new WP_Customize_Control($wp_customize, 'chc-news-callout-headline-control', array(
'label' => 'Nadpis',
'section' => 'chc-news-callout-section',
'settings' => 'chc-news-callout-headline'
)));
/* Text under paragraph */
$wp_customize->add_setting('chc-news-callout-paragraph', array(
'default' => 'Text sekce novinek'
));
$wp_customize->add_control( new WP_Customize_Control($wp_customize, 'chc-news-callout-paragraph-control', array(
'label' => 'Text',
'section' => 'chc-news-callout-section',
'settings' => 'chc-news-callout-paragraph',
'type' => 'textarea'
)));
/* Button text */
$wp_customize->add_setting('chc-news-callout-button-text', array(
'default' => 'Zobrazit více'
));
$wp_customize->add_control( new WP_Customize_Control($wp_customize, 'chc-news-callout-button-text-control', array(
'label' => 'Text na tlačítku',
'section' => 'chc-news-callout-section',
'settings' => 'chc-news-callout-button-text'
)));
/* Button link */
$wp_customize->add_setting('chc-news-callout-button-link');
$wp_customize->add_control( new WP_Customize_Control($wp_customize, 'chc-news-callout-button-link-control', array(
'label' => 'Odkaz tlačítka',
'section' => 'chc-news-callout-section',
'settings' => 'chc-news-callout-button-link',
'type' => 'dropdown-pages'
)));
/* -------------------------------------------------------------------------------------------------------------- */
$wp_customize->add_section('chc-fields-callout-section', array(
'title' => 'Sekce oborů a zaměření (úvodní stránka)'
));
/* Headline */
$wp_customize->add_setting('chc-fields-callout-headline', array(
'default' => 'Nadpis sekce zaměření'
));
$wp_customize->add_control( new WP_Customize_Control($wp_customize, 'chc-fields-callout-headline-control', array(
'label' => 'Nadpis',
'section' => 'chc-fields-callout-section',
'settings' => 'chc-fields-callout-headline'
)));
/* Text under paragraph */
$wp_customize->add_setting('chc-fields-callout-paragraph', array(
'default' => 'Text sekce zaměření'
));
$wp_customize->add_control( new WP_Customize_Control($wp_customize, 'chc-fields-callout-paragraph-control', array(
'label' => 'Text',
'section' => 'chc-fields-callout-section',
'settings' => 'chc-fields-callout-paragraph',
'type' => 'textarea'
)));
/* Button text */
$wp_customize->add_setting('chc-fields-callout-button-text', array(
'default' => 'Zobrazit více'
));
$wp_customize->add_control( new WP_Customize_Control($wp_customize, 'chc-fields-callout-button-text-control', array(
'label' => 'Text na tlačítku',
'section' => 'chc-fields-callout-section',
'settings' => 'chc-fields-callout-button-text'
)));
/* Button link */
$wp_customize->add_setting('chc-fields-callout-button-link');
$wp_customize->add_control( new WP_Customize_Control($wp_customize, 'chc-fields-callout-button-link-control', array(
'label' => 'Odkaz tlačítka - ID kategorie',
'section' => 'chc-fields-callout-section',
'settings' => 'chc-fields-callout-button-link',
)));
/* Obrázek vpravo */
$wp_customize->add_setting('chc-fields-callout-image');
$wp_customize->add_control( new WP_Customize_Image_Control($wp_customize, 'chc-fields-callout-image-control', array(
'label' => 'Obrázek vpravo',
'section' => 'chc-fields-callout-section',
'settings' => 'chc-fields-callout-image'
)));
/* -------------------------------------------------------------------------------------------------------------- */
$wp_customize->add_section('chc-footer-callout-section', array(
'title' => 'Footer'
));
/* Headline */
$wp_customize->add_setting('chc-footer-callout-headline', array(
'default' => 'Nadpis'
));
$wp_customize->add_control( new WP_Customize_Control($wp_customize, 'chc-footer-callout-headline-control', array(
'label' => 'Nadpis textu ve footeru',
'section' => 'chc-footer-callout-section',
'settings' => 'chc-footer-callout-headline'
)));
/* Text under paragraph */
$wp_customize->add_setting('chc-footer-callout-paragraph', array(
'default' => 'Text'
));
$wp_customize->add_control( new WP_Customize_Control($wp_customize, 'chc-footer-callout-paragraph-control', array(
'label' => 'Text ve footeru',
'section' => 'chc-footer-callout-section',
'settings' => 'chc-footer-callout-paragraph',
'type' => 'textarea'
)));
/* Useful buttons headline */
$wp_customize->add_setting('chc-footer-callout-useful-refs-text', array(
'default' => 'Užitečné odkazy'
));
$wp_customize->add_control( new WP_Customize_Control($wp_customize, 'chc-footer-callout-useful-refs-text-control', array(
'label' => 'Nadpis užitečných odkazů',
'section' => 'chc-footer-callout-section',
'settings' => 'chc-footer-callout-useful-refs-text'
)));
/* Button link 1 */
$wp_customize->add_setting('chc-footer-callout-link1');
$wp_customize->add_control( new WP_Customize_Control($wp_customize, 'chc-footer-callout-link1-control', array(
//'label' => '  ',
'section' => 'chc-footer-callout-section',
'settings' => 'chc-footer-callout-link1',
'type' => 'dropdown-pages'
)));
/* Button link 2 */
$wp_customize->add_setting('chc-footer-callout-link2');
$wp_customize->add_control( new WP_Customize_Control($wp_customize, 'chc-footer-callout-link2-control', array(
'section' => 'chc-footer-callout-section',
'settings' => 'chc-footer-callout-link2',
'type' => 'dropdown-pages'
)));
/* Button link 3 */
$wp_customize->add_setting('chc-footer-callout-link3');
$wp_customize->add_control( new WP_Customize_Control($wp_customize, 'chc-footer-callout-link3-control', array(
'section' => 'chc-footer-callout-section',
'settings' => 'chc-footer-callout-link3',
'type' => 'dropdown-pages'
)));
/* Button link 4 */
$wp_customize->add_setting('chc-footer-callout-link4');
$wp_customize->add_control( new WP_Customize_Control($wp_customize, 'chc-footer-callout-link4-control', array(
'section' => 'chc-footer-callout-section',
'settings' => 'chc-footer-callout-link4',
'type' => 'dropdown-pages'
)));
/* Contacts headline */
$wp_customize->add_setting('chc-footer-callout-contacts-headline-text', array(
'default' => 'Kontakty'
));
$wp_customize->add_control( new WP_Customize_Control($wp_customize, 'chc-footer-callout-contacts-headline-control', array(
'label' => 'Nadpis kontaktů',
'section' => 'chc-footer-callout-section',
'settings' => 'chc-footer-callout-contacts-headline-text'
)));
/* Address */
$wp_customize->add_setting('chc-footer-callout-address-text', array(
'default' => 'Filmová 174, 760 01 Zlín'
));
$wp_customize->add_control( new WP_Customize_Control($wp_customize, 'chc-footer-callout-address-text-control', array(
//'label' => '  ',
'section' => 'chc-footer-callout-section',
'settings' => 'chc-footer-callout-address-text'
)));
/* E-mail */
$wp_customize->add_setting('chc-footer-callout-email-text', array(
'default' => 'kontakt@creativehill.cz'
));
$wp_customize->add_control( new WP_Customize_Control($wp_customize, 'chc-footer-callout-email-text-control', array(
'section' => 'chc-footer-callout-section',
'settings' => 'chc-footer-callout-email-text'
)));
/* Phone number */
$wp_customize->add_setting('chc-footer-callout-phone-text', array(
'default' => '+420 725 878 303'
));
$wp_customize->add_control( new WP_Customize_Control($wp_customize, 'chc-footer-callout-phone-control', array(
'section' => 'chc-footer-callout-section',
'settings' => 'chc-footer-callout-phone-text'
)));
/* Open hours */
$wp_customize->add_setting('chc-footer-callout-open-hours-text', array(
'default' => 'pondělí - pátek 7:30 - 10:15'
));
$wp_customize->add_control( new WP_Customize_Control($wp_customize, 'chc-footer-callout-open-hours-control', array(
'section' => 'chc-footer-callout-section',
'settings' => 'chc-footer-callout-open-hours-text'
)));
/* -------------------------------------------------------------------------------------------------------------- */
$wp_customize->add_section('chc-handful-callout-section', array(
'title' => 'Užitečné dokumenty'
));
/* Užitečné dokumenty 1 */
$wp_customize->add_setting('chc-handful-callout-media-1');
$wp_customize->add_control( new WP_Customize_Media_Control($wp_customize, 'chc-handful-callout-media-1-control', array(
'mime_type' => 'application',
'label' => 'Dokument 1',
'section' => 'chc-handful-callout-section',
'settings' => 'chc-handful-callout-media-1'
)));
/* Užitečné dokumenty 2 */
$wp_customize->add_setting('chc-handful-callout-media-2');
$wp_customize->add_control( new WP_Customize_Media_Control($wp_customize, 'chc-handful-callout-media-2-control', array(
'mime_type' => 'application',
'label' => 'Dokument 2',
'section' => 'chc-handful-callout-section',
'settings' => 'chc-handful-callout-media-2'
)));
/* Užitečné dokumenty 3 */
$wp_customize->add_setting('chc-handful-callout-media-3');
$wp_customize->add_control( new WP_Customize_Media_Control($wp_customize, 'chc-handful-callout-media-3-control', array(
'mime_type' => 'application',
'label' => 'Dokument 3',
'section' => 'chc-handful-callout-section',
'settings' => 'chc-handful-callout-media-3'
)));
/* Užitečné dokumenty 4 */
$wp_customize->add_setting('chc-handful-callout-media-4');
$wp_customize->add_control( new WP_Customize_Media_Control($wp_customize, 'chc-handful-callout-media-4-control', array(
'mime_type' => 'application',
'label' => 'Dokument 4',
'section' => 'chc-handful-callout-section',
'settings' => 'chc-handful-callout-media-4'
)));
/* Užitečné dokumenty 5 */
$wp_customize->add_setting('chc-handful-callout-media-5');
$wp_customize->add_control( new WP_Customize_Media_Control($wp_customize, 'chc-handful-callout-media-5-control', array(
'mime_type' => 'application',
'label' => 'Dokument 5',
'section' => 'chc-handful-callout-section',
'settings' => 'chc-handful-callout-media-5'
)));
/* Užitečné dokumenty 6 */
$wp_customize->add_setting('chc-handful-callout-media-6');
$wp_customize->add_control( new WP_Customize_Media_Control($wp_customize, 'chc-handful-callout-media-6-control', array(
'mime_type' => 'application',
'label' => 'Dokument 6',
'section' => 'chc-handful-callout-section',
'settings' => 'chc-handful-callout-media-6'
)));
/* Užitečné dokumenty 7 */
$wp_customize->add_setting('chc-handful-callout-media-7');
$wp_customize->add_control( new WP_Customize_Media_Control($wp_customize, 'chc-handful-callout-media-7-control', array(
'mime_type' => 'application',
'label' => 'Dokument 7',
'section' => 'chc-handful-callout-section',
'settings' => 'chc-handful-callout-media-6'
)));
/* Užitečné dokumenty 8 */
$wp_customize->add_setting('chc-handful-callout-media-8');
$wp_customize->add_control( new WP_Customize_Media_Control($wp_customize, 'chc-handful-callout-media-8-control', array(
'mime_type' => 'application',
'label' => 'Dokument 8',
'section' => 'chc-handful-callout-section',
'settings' => 'chc-handful-callout-media-6'
)));
}
add_action('customize_register', 'chc_administration_callout');
function chc_pagination($currentpage, $prevpage, $nextpage) {
echo '<div class="pagination">';
echo '<ul>';
echo '<li><span>1</span></li>';
echo '<li><a href="#">2</a></li>';
echo '<li><a href="#">3</a></li>';
echo '<li><a href="#">4</a></li>';
echo '<li><a href="#">5</a></li>';
echo '</ul>';
echo '</div>';
}
// Register Custom Post Type
function create_team_members() {
function transactions_post_type() {
$labels = array(
'name' => 'Team',
'singular_name' => 'Team',
'menu_name' => 'Pedagogický tým',
'name_admin_bar' => 'Pedagogický tým',
'name' => 'Transactions',
'singular_name' => 'Transaction',
'menu_name' => 'Transactions',
'name_admin_bar' => 'Transactions',
'archives' => 'Item Archives',
'attributes' => 'Item Attributes',
'parent_item_colon' => 'Parent Item:',
......@@ -484,15 +100,17 @@ function create_team_members() {
'filter_items_list' => 'Filter items list',
);
$args = array(
'label' => 'Team',
'description' => 'Pedagogický tým',
'label' => 'Transaction',
'description' => 'Transaction as a post - post type',
'labels' => $labels,
'supports' => array( 'title', 'editor', 'thumbnail' ),
'supports' => array( 'title', 'editor' ),
'taxonomies' => array( 'category', 'post_tag' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-money',
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
......@@ -501,9 +119,9 @@ function create_team_members() {
'publicly_queryable' => true,
'capability_type' => 'page',
);
register_post_type( 'team', $args );
register_post_type( 'transaction', $args );
}
add_action( 'init', 'create_team_members', 0 );
add_action( 'init', 'transactions_post_type', 0 );
?>
\ No newline at end of file
<?php
/**
* The template for displaying 404 pages (not found)
*
* @link https://codex.wordpress.org/Creating_an_Error_404_Page
*
* @package WordPress
* @subpackage Twenty_Nineteen
* @since 1.0.0
*/
get_header();
?>
<div id="primary" class="content-area">
<main id="main" class="site-main">
<div class="error-404 not-found">
<header class="page-header">
<h1 class="page-title"><?php _e( 'Oops! That page can&rsquo;t be found.', 'twentynineteen' ); ?></h1>
</header><!-- .page-header -->
<div class="page-content">
<p><?php _e( 'It looks like nothing was found at this location. Maybe try a search?', 'twentynineteen' ); ?></p>
<?php get_search_form(); ?>
</div><!-- .page-content -->
</div><!-- .error-404 -->
</main><!-- #main -->
</div><!-- #primary -->
<?php
get_footer();
<?php
/**
* The template for displaying archive pages
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package WordPress
* @subpackage Twenty_Nineteen
* @since 1.0.0
*/
get_header();
?>
<div id="primary" class="content-area">
<main id="main" class="site-main">
<?php if ( have_posts() ) : ?>
<header class="page-header">
<?php
the_archive_title( '<h1 class="page-title">', '</h1>' );
?>
</header><!-- .page-header -->
<?php
// Start the Loop.
while ( have_posts() ) :
the_post();
/*
* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part( 'template-parts/content/content', 'excerpt' );
// End the loop.
endwhile;
// Previous/next page navigation.
twentynineteen_the_posts_navigation();
// If no content, include the "No posts found" template.
else :
get_template_part( 'template-parts/content/content', 'none' );
endif;
?>
</main><!-- #main -->
</div><!-- #primary -->
<?php
get_footer();
<?php
/**
* Custom comment walker for this theme
*
* @package WordPress
* @subpackage Twenty_Nineteen
* @since 1.0.0
*/
/**
* This class outputs custom comment walker for HTML5 friendly WordPress comment and threaded replies.
*
* @since 1.0.0
*/
class TwentyNineteen_Walker_Comment extends Walker_Comment {
/**
* Outputs a comment in the HTML5 format.
*
* @see wp_list_comments()
*
* @param WP_Comment $comment Comment to display.
* @param int $depth Depth of the current comment.
* @param array $args An array of arguments.
*/
protected function html5_comment( $comment, $depth, $args ) {
$tag = ( 'div' === $args['style'] ) ? 'div' : 'li';
?>
<<?php echo $tag; ?> id="comment-<?php comment_ID(); ?>" <?php comment_class( $this->has_children ? 'parent' : '', $comment ); ?>>
<article id="div-comment-<?php comment_ID(); ?>" class="comment-body">
<footer class="comment-meta">
<div class="comment-author vcard">
<?php
$comment_author_url = get_comment_author_url( $comment );
$comment_author = get_comment_author( $comment );
$avatar = get_avatar( $comment, $args['avatar_size'] );
if ( 0 != $args['avatar_size'] ) {
if ( empty( $comment_author_url ) ) {
echo $avatar;
} else {