Skip to content

Instantly share code, notes, and snippets.

View frankyonnetti's full-sized avatar

Frank Yonnetti frankyonnetti

View GitHub Profile
@frankyonnetti
frankyonnetti / Vimeo image.php
Created July 13, 2021 15:41
#video #vimeo Get image for video
// example: https://vimeo.com/api/oembed.json?url=https://vimeo.com/387724556
<?php
$vimeo_url = 'https://vimeo.com/387724556';
$data = json_decode(file_get_contents('http://vimeo.com/api/oembed.json?url=' . $vimeo_url));
echo '<img class="vimeo-video" src="' . $data->thumbnail_url . '" alt="Video: ' . $data->title . '">';
@frankyonnetti
frankyonnetti / MAMP - zshrc PATH.sh
Created June 1, 2021 21:26
MAMP - zshrc PATH #terminal #php #mysql
PATH="/usr/local/bin:/usr/local/sbin:$PATH"
PATH="/Applications/MAMP/bin/php/php7.x.x/bin:$PATH"
PATH="/Applications/MAMP/Library/bin:$PATH"
PATH="/usr/local/share:$PATH"
PATH="$HOME/.composer/vendor/bin:$PATH"
export PATH
@frankyonnetti
frankyonnetti / Drupal8--composer.md
Created May 25, 2021 20:03
Drupal 8 composer #drupal #d8 #composer #Install
@frankyonnetti
frankyonnetti / You have new mail.md
Last active May 23, 2021 21:28
You have new mail #terminal

You have new mail - annoying message

To fix remove file: /var/mail/<whatever_user>

@frankyonnetti
frankyonnetti / WordPress - use taxonomy in permalink URL.php
Created May 23, 2021 21:14
WordPress - use taxonomy in permalink URL #wordpress #permalink
@frankyonnetti
frankyonnetti / WordPress - pagination for CPT.phtml
Created May 23, 2021 21:13
WordPress - pagination for CPT #wordpress
<?php
// https://wpza.net/how-to-paginate-a-custom-post-type-in-wordpress
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$args = array(
'post_type' => 'custom_post_type_name',
'posts_per_page' => 10,
'paged' => $paged
);
$loop = new WP_Query( $args );
@frankyonnetti
frankyonnetti / WordPress - page excerpts.php
Created May 23, 2021 21:13
WordPress - excerpts for pages #wordpress #excerpts
<?php
/**
* Enabe excerpts for pages
*/
function THEME_enable_page_excerpt() {
add_post_type_support('page', array('excerpt'));
}
add_action('init', 'THEME_enable_page_excerpt');
@frankyonnetti
frankyonnetti / Wordpress - get_post_type.php
Created May 23, 2021 21:11
Wordpress - get_post_type() #wordpress
<?php printf( __( 'The post type is: %s', 'textdomain' ), get_post_type( get_the_ID() ) ); ?>
@frankyonnetti
frankyonnetti / WordPress - Get terms from post.phtml
Created May 23, 2021 21:10
WordPress - Get terms from post #wordpress #taxonomy
<?php
// project_tag is the term parent
<?php if (has_term($post->ID, 'project_tag')): ?>
<div class="blog-focus-areas">
<h3>Related Focus Areas</h3>
<?php echo get_the_term_list($post->ID, 'project_tag', '<ul><li>', ',</li><li>', '</li></ul>'); ?>
</div>
<?php endif; ?>
@frankyonnetti
frankyonnetti / WordPress - featured image path.phtml
Created May 23, 2021 21:10
WordPress - featured image path #wordpress #path