Skip to content

Instantly share code, notes, and snippets.

View DanCanetti's full-sized avatar
:octocat:
Unlimited free private repos!

Daniel Canetti DanCanetti

:octocat:
Unlimited free private repos!
View GitHub Profile
@DanCanetti
DanCanetti / is_child.php
Created May 25, 2021 10:44
WordPress is_child by slug (add to functions.php)
// Is child
function is_child($post_slug) {
global $post;
$parent_id = $post->post_parent;
$post_slug = get_post_field( 'post_name', $parent_id );
if( is_page() && ($post_slug) ) {
return true;
} else {
return false;
}
@DanCanetti
DanCanetti / collection.html
Created February 28, 2021 22:32
If first item in loop in Eleventy
{% for key in collection %}
{% if forloop.first == true %}
<p>{{ key.data.dataName }}</p>
{% endif %}
{% endfor %}
@DanCanetti
DanCanetti / dark-gist.scss
Last active February 23, 2021 15:37
Gist Embed - Dark Theme
.gist {
.blob-wrapper {
padding: 15px 0;
background-color: #000;
.highlight {
background-color: #000;
}
td {
color: #fff;
}
@DanCanetti
DanCanetti / columns.html
Created January 18, 2021 16:07
CSS Columns
<ul class="column-list">
<li>One</li>
<li>Two</li>
<li>Three</li>
</ul>
@DanCanetti
DanCanetti / _form.scss
Last active March 15, 2021 05:20
Inline Google Recaptcha and parsley.js form validation
.FORM_CLASS {
// Form styles
&--complete {
#submitForm {
position: relative;
&::after {
content: "";
position: absolute;
z-index: 100;
cursor: not-allowed;
@DanCanetti
DanCanetti / ajax_jsonp.js
Last active August 6, 2020 15:32 — forked from codingjester/ajax_jsonp.js
User JQuery with the Tumblr API & JSONP
// More explicit information + handling the result
$.ajax('https://api.tumblr.com/v2/blog/codingjester.tumblr.com/posts',
{
dataType:'jsonp',
data: {
limit : 1,
api_key : 'your_key'
},
success: function(posts) {
var postings = posts.response.posts;