Skip to content

Instantly share code, notes, and snippets.

@AlkarE
AlkarE / git.migrate
Created March 10, 2018 22:23 — forked from niksumeiko/git.migrate
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.
@AlkarE
AlkarE / Functions
Created June 25, 2018 07:26 — forked from nusserstudios/Functions
Zurb Foundation Pagination Function for WordPress
<?php
function foundation_pagination($before = '', $after = '') {
global $wpdb, $wp_query;
$request = $wp_query->request;
$posts_per_page = intval(get_query_var('posts_per_page'));
$paged = intval(get_query_var('paged'));
$numposts = $wp_query->found_posts;
$max_page = $wp_query->max_num_pages;
if ( $numposts <= $posts_per_page ) { return; }
if(empty($paged) || $paged == 0) {
add_filter( 'allowed_http_origins', 'add_allowed_origins' );
function add_allowed_origins( $origins ) {
$origins[] = 'https://site1.example.com';
$origins[] = 'https://site2.example.com';
return $origins;
}
<div class="accordion">
<div class="accordion-header">Et quasi architecto</div>
<div class="accordion-content">Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.</div>
<div class="accordion-header">Nemo enim ipsam</div>
<div class="accordion-content">Et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.</div>
<div class="accordion-header">Sed ut perspiciatis</div>
<div class="accordion-content">Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur.</div>
</div>
<div class="hero">
<div class="container">
<div class="blogItem blogItem__fl">
<div class="blogItem__cat">
<div class="b-center">Lorem ipsum dolor sit amet.</div>
</div>
<div class="blogItem__dt">10/12/2012</div>
</div>
<div class="blogItem blogItem__fl">
<div class="blogItem__cat">
<?php
class MyTheme
{
private function actionAfterSetup($function)
{
add_action('after_setup_theme', function() use ($function) {
$function();
});
}
<?php
$args = array(
'label' => '', // Text in Label
'class' => '',
'style' => '',
'wrapper_class' => '',
'value' => '', // if empty, retrieved from post meta where id is the meta_key
'id' => '', // required
'name' => '', //name will set from id if empty
add_action( 'woocommerce_before_order_notes', 'bbloomer_add_custom_checkout_field' );
function bbloomer_add_custom_checkout_field( $checkout ) {
$current_user = wp_get_current_user();
$saved_license_no = $current_user->license_no;
woocommerce_form_field( 'license_no', array(
'type' => 'text',
'class' => array( 'form-row-wide' ),
'label' => 'License Number',
'placeholder' => 'CA12345678',
@AlkarE
AlkarE / function.php
Created September 21, 2021 19:58 — forked from dn7734/function.php
wordpress sage function.php
<?php
/**
* Sage includes
*
* The $sage_includes array determines the code library included in your theme.
* Add or remove files to the array as needed. Supports child theme overrides.
*
* Please note that missing files will produce a fatal error.
*
* @link https://github.com/roots/sage/pull/1042