Skip to content

Instantly share code, notes, and snippets.

View frrrnd's full-sized avatar
✍️
Designing

Fernando Soares frrrnd

✍️
Designing
View GitHub Profile
@frrrnd
frrrnd / gist:3431e98562e41a95d82b432dd83a11ac
Created November 28, 2019 14:57 — forked from DevinWalker/gist:6fb2783c05b46a2ba251
WordPress: Loop through Categories and Display Posts Within
<?php
/*
* Loop through Categories and Display Posts within
*/
$post_type = 'features';
// Get all the taxonomies for this post type
$taxonomies = get_object_taxonomies( array( 'post_type' => $post_type ) );
foreach( $taxonomies as $taxonomy ) :
@frrrnd
frrrnd / get-all-categories.php
Created November 28, 2019 14:50
get all categories from cpt
<?php
$args = array(
'public' => true,
'_builtin' => false
);
$output = 'names';
$operator = 'and';
$taxonomies = get_taxonomies($args, $output, $operator);
@frrrnd
frrrnd / get-tax.php
Created November 28, 2019 12:31
Get all categories from taxonomies.
<?php
$partners = array();
$partners_obj = get_terms( 'portfolio', array('hide_empty' => false) );
echo '<pre>' . print_r( $partners_obj, true ) . '</pre>';
echo '<hr>';
$partners[''] = '-';
foreach ($partners_obj as $partner) {
$partners[$partner->term_id] = $partner->name;;
}
@frrrnd
frrrnd / smooth-scroll.js
Created November 22, 2019 17:11
Smooth anchor scroll.
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
});
@frrrnd
frrrnd / github-ubuntu.sh
Created June 9, 2019 13:45 — forked from dstroot/github-ubuntu.sh
Setting up github on Ubuntu
#!/bin/bash
###############################################
# To use:
# wget https://raw.github.com/gist/4411254
# chmod 777 github-ubuntu.sh
# ./github-ubuntu.sh
###############################################
echo "*****************************************"
echo " Step 1: Check your keys"
echo "*****************************************"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@frrrnd
frrrnd / jekyll-post-thor.md
Created March 22, 2017 03:06 — forked from ichadhr/jekyll-post-thor.md
Jekyll create post with command

CREATE JEKYLL POSTS FROM THE COMMAND LINE

I got tired on creating new files manually for each new post a write so I put together this little command line task with Thor.

It creates a new file in the _posts directory with today’s date, parses the parameters to command as the post’s title and adds that as a slug to the new file. It then writes a default yaml template to the file (as specified in the script).

Running thor jekyll:new New and shiny post will for example create the file _posts/2012-12-28-new-and-shiny-post.markdown, populate it with an yaml template and finally open the file in my favorite editor.

HOW TO

Add the following to your Gemfile:

@frrrnd
frrrnd / down.svg
Created January 20, 2017 13:15
download
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
In terminal, type:
scutil --get HostName
Set hostname:
sudo scutil --set HostName 'yourHostName'