Skip to content

Instantly share code, notes, and snippets.

View hsimah's full-sized avatar

hsimah

View GitHub Profile
@hsimah
hsimah / wpgraphql_register_custom_mutation_inputs.php
Created June 17, 2021 14:36
wpgraphql_register_custom_mutation_inputs.php
<?php
$graphql_singular_name = 'Post';
$graphql_field_type = 'String';
$field_config = [
'name' => 'The human readable ACF field name',
'graphql_name' => 'The GraphQL field name, eg first_name',
];
add_filter('graphql_input_fields', function ($fields, $type_name) use ($graphql_singular_name, $graphql_field_type, $field_config) {
if ($type_name === "Create{$graphql_singular_name}Input" || $type_name === "Update{$graphql_singular_name}Input") {
@hsimah
hsimah / register_fields.php
Last active June 7, 2021 01:32
Register custom query inputs
// this assumes you have registered a Type called YourPostType
add_filter('graphql_input_fields', function ($fields, $type_name, $config) {
if (isset($config['queryClass']) && 'WP_Query' === $config['queryClass']) {
if ('RootQueryToYourPostTypeConnectionWhereArgs' === $type_name) {
$fields['custom_attribute'] = [
'name' => 'custom_attribute',
'type' => 'Boolean',
'description' => __('A custom boolean attribute', 'hello-there'),
];
}
@hsimah
hsimah / .devcontainer.json
Last active September 6, 2020 21:18
VS Code devcontainer.json for WordPress, WSL2 & Docker
{
"name": "My Plugin",
"dockerComposeFile": [
"docker-compose.yml"
],
"service": "wordpress",
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
"eslint.alwaysShowStatus": true,
"eslint.format.enable": true,
@hsimah
hsimah / Dockerfile
Created September 6, 2020 21:08
Final Dockerfile for WordPress, WSL2 & Docker
#####################################################################
# Pre-configured WordPress Installation w/ for rhomboid development #
# For testing only, use in production not recommended. #
#####################################################################
FROM wordpress:latest
LABEL author=hsimah
LABEL author_uri=https://github.com/hsimah-services
@hsimah
hsimah / docker-compose.yml
Created September 6, 2020 21:07
Final docker-compose.yml for WordPress, WSL2 & Docker
version: "3.7"
services:
wordpress:
container_name: www
build:
context: .
dockerfile: ./Dockerfile
links:
- mysql
@hsimah
hsimah / .bashrc
Created September 6, 2020 21:05
.bashrc for WordPress, WSL2 & Docker
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
@hsimah
hsimah / Dockerfile
Created September 6, 2020 20:58
Node-react Dockerfile for WordPress, WSL2 & Docker
########################################################################
# Pre-configured WordPress Installation for local PHP/node development #
# For development & testing only, use in production not recommended. #
########################################################################
FROM wordpress:latest
LABEL author=hsimah
LABEL author_uri=https://github.com/hsimah-services
@hsimah
hsimah / docker-compose.yml
Last active September 6, 2020 20:57
Node-ready docker-compose.yml for WordPress, WSL2 & Docker
version: "3.7"
services:
wordpress:
container_name: www
build:
context: .
dockerfile: ./Dockerfile
links:
- mysql
@hsimah
hsimah / docker-compose.yml
Last active September 6, 2020 20:54
Add wp-content to docker-compose.yml for WordPress, WSL2 & Docker
version: "3.7"
services:
wordpress:
container_name: www
build:
context: .
dockerfile: ./Dockerfile
links:
- mysql
@hsimah
hsimah / docker-compose.yml
Created September 6, 2020 20:38
Initial docker-compose.yml for WordPress, WSL2 & Docker
version: "3.7"
services:
wordpress:
container_name: www
build:
context: .
dockerfile: ./Dockerfile
links:
- mysql