Skip to content

Instantly share code, notes, and snippets.

View marceloxp's full-sized avatar
:octocat:
Learning

Marcelo de Souza Lima marceloxp

:octocat:
Learning
View GitHub Profile
@jasonbahl
jasonbahl / like-posts.php
Created December 10, 2018 22:06
Adding a "likePost" mutation for WPGraphQL
add_action( 'graphql_register_types', function() {
register_graphql_field( 'Post', 'likeCount', [
'type' => 'Int',
'description' => __( 'The number of likes for the post', 'your-textdomain' ),
'resolve' => function( $post ) {
$likes = get_post_meta( $post->ID, 'likes', true );
return isset( $likes ) ? (int) $likes : 0;
}
] );
@marceloxp
marceloxp / apache.md
Last active November 7, 2022 17:48
Apache Tips

Apache Tips

Basic tips commands to Apache for PHP

Install:

sudo apt update
sudo apt install apache2

Conf file:

@learncodeacademy
learncodeacademy / webpack.config.js
Created January 8, 2016 03:55
Sample Basic Webpack Config
var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
module.exports = {
context: __dirname,
devtool: debug ? "inline-sourcemap" : null,
entry: "./js/scripts.js",
output: {
path: __dirname + "/js",
filename: "scripts.min.js"
<?php
/**
* Plugin Name: Static Templates
*
* If most of your site content is in .php template files, and you're tired of
* creating new pages, assigning them page templates, creating page templates
* then doing it all over again on production, this plugin is for you.
*
* Examples:
*