danieldudzic / adler Goto Github PK
View Code? Open in Web Editor NEWLicense: GNU General Public License v2.0
License: GNU General Public License v2.0
Adler includes some styling which is determined by the presence or absence of a featured image for the post ( or the first post in a loop ):
.page .has-thumbnail .hero__content {
margin-bottom: 40px;
}
.single .no-thumbnail .header-content .hero__meta {
display: none;
}
.single .has-thumbnail .post,
.single .no-thumbnail .post {
background-color: transparent;
}
.page.no-thumbnail .site-branding .site-title {
color: #0e364f;
}
.single .has-thumbnail .post,
.single .no-thumbnail .post {
background-color: transparent;
}
.single .no-thumbnail .header-content .hero__meta {
display: none;
}
.no-thumbnail .site-header {
position: relative;
border-bottom: none;
background-color: transparent;
}
.no-thumbnail .site-header a {
border-bottom: none;
}
<div id="page" class="site <?php echo ( has_post_thumbnail() ) ? 'has-thumbnail' : 'no-thumbnail'; ?>">
I strongly suspect this won't fly on WordPress.com.
For now, I have removed the logic from the header.php file and moved it to the file inc/extras.php:
function adler_body_classes( $classes ) {
// Adds a class of has-post-thumbnail if the featured image is set ( or the first post in the loop has the featured image set ) and a class of no-post-thumbnail if the featured image is missing.
if ( has_post_thumbnail() ) {
$classes[] = 'has-post-thumbnail';
} else {
$classes[] = 'no-post-thumbnail';
}
return $classes;
}
add_filter( 'body_class', 'adler_body_classes' );
I need to confirm whether:
has_post_thumbnail()
check is valid ( and appropriate outside of the loop )has-post-thumbnail
and no-post-thumbnail
are acceptable for class names ( I am aware that WordPress adds the has-post-thumbnail
class to the .post
- so there might be a potential conflict )A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.