Tinkering
The thing I love the most about my personal site is just tinkering away at it over time.
I wanted to put a little box at the end of proper posts—y’know like css stuff—so if someone liked reading it, the could see about me and the agency.
I only wanted to show it only if my post was in a couple of defined categories, so I slung a bit of PHP and HTML together:
<?php
$allowedCount = array_filter(get_the_category(), function($cat) {
$allowedCategories = ['CSS', 'Agency', 'Design', 'Development'];
return in_array($cat->name, $allowedCategories);
});
?>
<?php if(count($allowedCount) > 0): ?>
<div class="bg-primary-glare p-m flow">
<p>👋 Hello, I’m Andy and I’ll help you build fast & visually stunning websites.</p>
<p>I’m the founder of <a href="https://set.studio">Set Studio</a>, a creative agency that specialises in building stunning websites that work for <strong>everyone</strong>. If you’ve got a project in mind, <a href="mailto:[email protected]">get in touch</a>.</p>
</div>
<hr />
<?php endif; ?>
I added a utility class or two and job done! A nice little box that only shows on the right sort of posts.
👋 Hello, I’m Andy and this is my little home on the web.
I’m the founder of Set Studio, a creative agency that specialises in building stunning websites that work for everyone and Piccalilli, a publication that will level you up as a front-end developer.
Back to blog