Skip to content

Instantly share code, notes, and snippets.

View joseph-farruggio's full-sized avatar

Joseph Farruggio joseph-farruggio

View GitHub Profile
<?php
$category = get_field('category');
// query arguments
$args = array(
'category__in' => $category->term_id;
'post_status' => 'publish',
'posts_per_page' => 10,
'orderby' => 'date',
{
"name": "your_name",
"version": "1.2.0",
"description": "Your Description",
"main": "webpack.mix.js",
"devDependencies": {
"@tailwindcss/custom-forms": "^0.2.1",
"@tailwindcss/forms": "^0.3.2",
"@tailwindcss/typography": "^0.4.0",
"ajv": "^6.12.6",
// webpack.mix.js test
let mix = require('laravel-mix');
let tailwindcss = require('tailwindcss');
mix.setPublicPath('assets/dist');
mix.js('assets/src/js/main.js', "assets/dist/js/main.min.js").version();
mix.sass("assets/src/scss/theme.scss", "assets/dist/css/theme.min.css").options({
postCss: [ tailwindcss('./tailwind.config.js') ],
@joseph-farruggio
joseph-farruggio / get_parent_block_field.php
Last active January 22, 2023 23:12
Returns a specified field from the parent ACF block.
<?php
/**
* Returns a specified ACF field from a parent block
* @param string $child_id The ID of the child ACF block
* @param string $child_name The name of the child ACF block
* @param string $parent_name The name of the parent ACF block
* @param string $field The name of the parent's custom field to return
* @param boolean $return_first If $field is an array, optionally return the first item.
*/
function get_field_from_parent($child_id, $child_name, $parent_name, $field, $return_first = false) {
<?php
$args = wp_parse_args(
$args,
array(
'button' => get_field('button')
)
);
if ($args['button]): ?>
@joseph-farruggio
joseph-farruggio / master.yml
Last active August 22, 2023 22:00
Github Action for deploying a WordPress plugin
name: Build and Publish Production Plugin
on:
push:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
<?php
/**
* A function that takes an array of HTML attribute
* key/value pairs and returns a string of HTML attributes.
**/
function unwrap_html_attrs($attrs)
{
$attributes = '';