Skip to content

Instantly share code, notes, and snippets.

View alinademi's full-sized avatar

Ali Demi alinademi

  • Vancouver
View GitHub Profile
@alinademi
alinademi / wordpress-tutorials.md
Created March 4, 2021 05:27 — forked from sibinx7/wordpress-tutorials.md
Wordpress Advanced Tutorials
<?php
/**
* The template used for displaying a CTA block.
*
* @package _s
*/
// Set up fields.
$title = get_sub_field( 'title' );
$text = get_sub_field( 'text' );
@alinademi
alinademi / testimonial_carousel.php
Created March 23, 2021 17:51 — forked from morgyface/testimonial_carousel.php
Testimonial carousel | Wordpress | ACF | Bootstrap
@alinademi
alinademi / How to get Gutenberg core blocks list or attributes.js
Last active April 6, 2021 00:41
How to get Gutenberg core blocks list or attributes
// To fetch the list of all registered blocks in the JS, we can do something like this:
wp.blocks.getBlockTypes() // in browser console.
// Also, to get a list of blocks for a particular namespace, you may use something like this:
wp.blocks.getBlockTypes().filter((block) => { return block.name.indexOf('core') !== -1});
// (This will list all blocks with namespace 'core'
// https://gist.github.com/DavidPeralvarez/37c8c148f890d946fadb2c25589baf00#gistcomment-3658460
------------------------------
@alinademi
alinademi / spacing-utilities.css
Created April 9, 2021 22:36 — forked from BrianSipple/spacing-utilities.css
CSS Spacing Utilities
@import "../variables/_spacing.css";
/*
* SPACING UTILITIES
*
* Utilities for setting padding and margin.
*
* Legend:
*
* Rules:
@alinademi
alinademi / wp-bootstrap4.4-pagination.php
Created April 13, 2021 03:06 — forked from mtx-z/wp-bootstrap4.4-pagination.php
Wordpress 5.4 Bootstrap 4.4 pagination (with custom WP_Query() and global $wp_query support)
<?php
/**
* @param WP_Query|null $wp_query
* @param bool $echo
* @param array $params
*
* @return string|null
*
* Accepts a WP_Query instance to build pagination (for custom wp_query()),
* or nothing to use the current global $wp_query (eg: taxonomy term page)
@alinademi
alinademi / functions_custom-cols.php
Created April 17, 2021 04:42 — forked from morgyface/functions_custom-cols.php
WordPress | Advanced Custom Fields | Create custom columns within admin for a custom post type using ACF
<?php
// Change the columns for the releases list screen
function change_columns( $cols ) {
$cols = array(
'cb' => '<input type="checkbox" />',
'featimg' => 'Featured Image',
'excerpt' => 'Excerpt?',
'title' => 'Title',
'artist' => 'Artist',
'catno' => 'Cat#',
@alinademi
alinademi / honeypot-example.php
Created April 20, 2021 08:09 — forked from andrewlimaza/honeypot-example.php
Simple honeypot for an HTML form using PHP
<?php
//check if form was sent
if($_POST){
$to = '[email protected]';
$subject = 'Testing HoneyPot';
$header = "From: $name <$name>";
$name = $_POST['name'];
@alinademi
alinademi / gutenberg-sidebar-add-attr-and-prop.js
Created April 22, 2021 19:49 — forked from richardtape/gutenberg-sidebar-add-attr-and-prop.js
Create custom gutenberg sidebar panel and control [add extra attr and props]
// See https://richardtape.com/?p=348
/**
* Filters registered block settings, extending attributes with our custom data.
*
* @param {Object} settings Original block settings.
*
* @return {Object} Filtered block settings.
*/
export function addAttribute( settings ) {
<?php
/**
* Plugin Name: My Custom Shortcodes
* Plugin URI: https://wordpress.org/plugins/my-custom-shortcodes/
* Description: Custom shortcode for plugin development talk
* Version: 1.0
* Requires at least: 5.2
* Requires PHP: 7.2
* Author: Jeffrey Carandang
* Author URI: https://jeffreycarandang.com/