Skip to content

Instantly share code, notes, and snippets.

View DiegoGonzalezCruz's full-sized avatar
🎯
Focusing

Diego González Cruz DiegoGonzalezCruz

🎯
Focusing
View GitHub Profile

In this article I'm going to walk you through process of creating Wordpress plugins. First I'm going to talk about some of the basic concepts in Wordpress plugin development like the actions, hooks, and API's that makes up Wordpress. Then were going to build a plugin where we apply some of the concepts and best practices in developing Wordpress plugins.

###Prerequisites

In order to fully benefit from this tutorial you should have a basic knowledge on PHP. As Wordpress is running on PHP and most of the code that we will be writing will be on PHP. A little bit of knowledge on HTML, CSS and JavaScript is also helpful but not required for this tutorial.

@DiegoGonzalezCruz
DiegoGonzalezCruz / docker-help.md
Created December 27, 2021 20:15 — forked from bradtraversy/docker-help.md
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

@DiegoGonzalezCruz
DiegoGonzalezCruz / learndash-graphql.php
Created February 9, 2022 10:56 — forked from izzygld/learndash-graphql.php
Replace REST API with @wpgraphql with @apollographql client.
<?php
add_filter( 'register_post_type_args', function( $args, $post_type ) {
if ( 'sfwd-courses' === $post_type ) {
$args['show_in_graphql'] = true;
$args['graphql_single_name'] = 'course';
$args['graphql_plural_name'] = 'courses';
}
// This adapter only works with JWT. Sessions are not available.
// If you want to make it work, rewrite the logic to admin sdk for node.
import { adminDb } from "./firebaseAdmin"
export default function FirebaseAdapter(client, options = {}) {
const usersRef = adminDb.collection("users")

Demo

Context

useViewportScroll is a great way to create a parallax effect as the page scrolls. In some cases however, we only want to scroll when an element is in the viewport area.

So for example, if we have a "landscape" scene, and want to animate the Sun object only when it's in view, we start with our useViewportScroll implementation:

function Sun(props) {
 const { scrollY, scrollYProgress } = useViewportScroll();
@DiegoGonzalezCruz
DiegoGonzalezCruz / comunas-regiones.json
Created June 23, 2022 22:06 — forked from juanbrujo/comunas-regiones.json
Comunas y regiones de chile JSON
{
"regiones": [{
"region": "Arica y Parinacota",
"comunas": ["Arica", "Camarones", "Putre", "General Lagos"]
},
{
"region": "Tarapacá",
"comunas": ["Iquique", "Alto Hospicio", "Pozo Almonte", "Camiña", "Colchane", "Huara", "Pica"]
},
{