Skip to content

Instantly share code, notes, and snippets.

View alinademi's full-sized avatar

Ali Demi alinademi

  • Vancouver
View GitHub Profile
@alinademi
alinademi / Block Names.md
Created February 5, 2021 06:13 — forked from megclaypool/Block Names.md
Bill Erickson's [Block Styles in Gutenberg](https://www.billerickson.net/block-styles-in-gutenberg/) see Contra Costa backend for example :)

List of block names You need to know the full block name in order to attach or remove styles from it. Here’s a list of all the core blocks (excluding all the embed ones):

core/paragraph
core/image
core/heading
core/gallery
core/list
core/quote
core/audio

@alinademi
alinademi / name_widget.php
Created February 11, 2021 23:14 — forked from ahmadawais/name_widget.php
WordPress Widget Boilerplate
<?php
/*
Plugin Name: WP Widget
Plugin URI: http://AhmadAwais.com
Description: This is a widget boilerplate.
Version: 1.0
Author: Ahmad Awais
Author URI: http://AhmadAwais.com
*/
// If this file is called directly, abort.
@alinademi
alinademi / notion2blog.js
Created February 11, 2021 23:14 — forked from ahmadawais/notion2blog.js
Notion.so > Personal Blog | custom domain + disqus comment
const MY_DOMAIN = "agodrich.com"
const START_PAGE = "https://www.notion.so/gatsby-starter-notion-2c5e3d685aa341088d4cd8daca52fcc2"
const DISQUS_SHORTNAME = "agodrich"
addEventListener('fetch', event => {
event.respondWith(fetchAndApply(event.request))
})
const corsHeaders = {
"Access-Control-Allow-Origin": "*",
@alinademi
alinademi / CustomWidgetFile.php
Created February 17, 2021 07:16 — forked from jonathonbyrdziak/CustomWidgetFile.php
EMPTY WIDGET Plugin code to create a single widget in wordpress.
<?php
/**
* Duplicate this file as many times as you would like, just be sure to change the
* Empty_Widget class name to a custom name of your choice. Have fun! redrokk.com
*
* Plugin Name: Empty Widget
* Description: Single Widget Class handles all of the widget responsibility, all that you need to do is create the html. Just use Find/Replace on the Contact_RedRokk_Widget keyword to rebrand this class for your needs.
* Author: RedRokk Interactive Media
* Version: 1.0.0
* Author URI: http://www.redrokk.com
@alinademi
alinademi / plugin-settings.php
Created February 18, 2021 05:08 — forked from annalinneajohansson/plugin-settings.php
A base for a WordPress plugin settings page, using the Settings API #add_options_page #add_action #admin_init #register_setting #add_settings_section
<?php
# http://kovshenin.com/2012/the-wordpress-settings-api/
# http://codex.wordpress.org/Settings_API
add_action( 'admin_menu', 'my_admin_menu' );
function my_admin_menu() {
add_options_page( __('My Plugin Options', 'textdomain' ), __('My Plugin Options', 'textdomain' ), 'manage_options', 'my-plugin', 'my_options_page' );
}
add_action( 'admin_init', 'my_admin_init' );
@alinademi
alinademi / sliderExample.php
Created February 22, 2021 03:02 — forked from dajocarter/sliderExample.php
Example of using a slider with Glide.js and Scratch Theme for Wordpress + ACF
<?php if(have_rows('slides')): ?>
<div id="Glide" class="glide clearfix">
<div class="glide__arrows">
<!--
Options for arrow classes are: ion-chevron-left/right, ion-ios-arrow-left/right, ion-ios-arrow-back/forward.
Can also substitute <i></i> with text, e.g., Previous and Next.
-->
<button class="glide__arrow prev" data-glide-dir="<"><i class="ion ion-chevron-left"></i></button>
<button class="glide__arrow next" data-glide-dir=">"><i class="ion ion-chevron-right"></i></button>
@alinademi
alinademi / assets.php
Created February 22, 2021 03:56 — forked from danielpataki/assets.php
Featured Content Widget
public function mfc_assets()
{
wp_enqueue_script('media-upload');
wp_enqueue_script('thickbox');
wp_enqueue_script('mfc-media-upload', plugin_dir_url(__FILE__) . 'mfc-media-upload.js', array( 'jquery' )) ;
wp_enqueue_style('thickbox');
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="description" content="CSS3 rotate background image only, not element" />
<meta charset="UTF-8" />
<title>Background Image Transformations</title>
<style>
body
{
font-family: arial, helvetica, freesans, sans-serif;
@alinademi
alinademi / yoast_seo_breadcrumb_add_woo_shop.php
Created March 2, 2021 23:59 — forked from amboutwe/yoast_seo_breadcrumb_add_woo_shop.php
Multiple examples of how to customize the Yoast SEO breadcrumbs
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/*
* Add shop link to the Yoast SEO breadcrumbs for a WooCommerce shop page.
* Credit: https://wordpress.stackexchange.com/users/8495/rjb
* Last Tested: Apr 20 2017 using Yoast SEO 4.6 on WordPress 4.7.3
*/
add_filter( 'wpseo_breadcrumb_links', 'wpseo_breadcrumb_add_woo_shop_link' );
@alinademi
alinademi / example.php
Created March 3, 2021 22:10 — forked from igorbenic/example.php
Taxonomy Rewrite Example
<?php
function rewriting_resources($wp_rewrite) {
$rules = array();
$terms = get_terms( array(
'taxonomy' => 'resource_type',
'hide_empty' => false,
) );
$post_type = 'resources';