reusable logos snippets

This commit is contained in:
cupcakearmy 2019-05-06 21:35:35 +02:00
parent 967d0ef870
commit a290ab34e2
4 changed files with 57 additions and 30 deletions

14
liquet/css/logos.css Normal file
View File

@ -0,0 +1,14 @@
#logos {
margin: 1.5em 0 0 0;
}
#logos img {
height: 2em;
width: 2em;
margin: 0 .5em;
transition: var(--animation);
}
#logos img:hover {
transform: scale(1.15);
}

View File

@ -1,41 +1,31 @@
<?php get_header();
<?php
include_once( 'logos.php' );
include_once( 'tags.php' );
$tags = get_tags(['orderby' => 'count', 'order' => 'desc']);
//$tags = array_map(function ($tag) {
// return [
// 'name' => $tag->name,
// 'slug' => $tag->slug,
// 'count' => $tag->count,
// ];
//}, $tags)
get_header();
$tags = get_tags( [ 'orderby' => 'count', 'order' => 'desc' ] );
?>
<div id="home">
<div class="flex container vertical middle" id="list-header">
<div id="header">
<a href="<?= get_bloginfo('wpurl'); ?>">
<h1><?= get_bloginfo('name'); ?></h1>
<h3><?= get_bloginfo('description'); ?></h3>
<a href="<?= get_bloginfo( 'wpurl' ); ?>">
<h1><?= get_bloginfo( 'name' ); ?></h1>
<h3><?= get_bloginfo( 'description' ); ?></h3>
</a>
<?php render_links(); ?>
</div>
</div>
<div class="flex container horizontal center" id="list-container">
<div id="list">
<?php if ($tags) { ?>
<!-- <div class="flex container horizontal center" id="list-container">-->
<div class="tags">
<?php foreach ($tags as $tag) { ?>
<a class="tag" href="<?= get_tag_link($tag->term_id); ?>"><?= $tag->name; ?> <b><?= $tag->count ?></b></a>
<?php } ?>
</div>
<!-- </div>-->
<?php } ?>
<?php render_all_tags(); ?>
<br/><br/><br/>
<?php
while (have_posts()) {
the_post();
get_template_part('post-preview', get_post_format());
}
?>
<?php
while ( have_posts() ) {
the_post();
get_template_part( 'post-preview', get_post_format() );
}
?>
</div>
</div>
</div>

19
liquet/logos.php Normal file
View File

@ -0,0 +1,19 @@
<?php
$links = [ 'medium', 'github', 'twitter', 'website' ];
function render_links() {
global $links;
?>
<div class="flex container horizontal middle center" id="logos"><?php
foreach ( $links as $link ) {
$saved = get_option( $link . '_url' );
if ( $saved ) { ?>
<a href="<?= $saved ?>" target="_blank">
<img src="<?= get_template_directory_uri() . '/vendor/logos/' . $link . '.png' ?>"
alt="<?= $link; ?>"/>
</a>
<?php }
}
?></div><?php
}

View File

@ -1,10 +1,12 @@
<?php
include_once( 'loop-utils.php' );
include_once( 'logos.php' );
include_once( 'tags.php' );
get_header();
the_post();
include_once( 'loop-utils.php' );
$dates = getDates();
?>
@ -43,7 +45,9 @@ $dates = getDates();
<br><br>
<?php the_content(); ?>
<br>
<?php get_template_part( 'tags-list', get_post_format() ); ?>
<?php render_current_tags(); ?>
<hr>
<?php render_links(); ?>
</div>
</div>