Skip to content

Instantly share code, notes, and snippets.

@wecodelaravel
wecodelaravel / index.html
Created May 24, 2017 05:21 — forked from anonymous/index.html
Responsive UI Test
<div class="row bluegrad">
<div class="section marginauto">
<div class="box left">
<div class="titletext">
<h2>Intro</h2>
<hr />
<p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam ac vehicula dui. Pellentesque nisi lectus, egestas vitae tempus eleifend.</p>
</div>
</div>
<div class="box right">
@wecodelaravel
wecodelaravel / delete-all-woocommerce-products.php
Created April 24, 2018 06:30 — forked from mikaelz/delete-all-woocommerce-products.php
Remove all WooCommerce products from database via SQL
<?php
require dirname(__FILE__).'/wp-blog-header.php';
$wpdb->query("DELETE FROM wp_terms WHERE term_id IN (SELECT term_id FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%')");
$wpdb->query("DELETE FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%'");
$wpdb->query("DELETE FROM wp_term_relationships WHERE term_taxonomy_id not IN (SELECT term_taxonomy_id FROM wp_term_taxonomy)");
$wpdb->query("DELETE FROM wp_term_relationships WHERE object_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'))");
$wpdb->query("DELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'))");
$wpdb->query("DELETE FROM wp_posts WHERE post_type IN ('product','product_variation')");
@wecodelaravel
wecodelaravel / remote-file-copy.php
Created September 13, 2018 23:22 — forked from kongondo/remote-file-copy.php
Remote file copying with progress reporting in PHP.
<?php
/*
* Remote File Copy PHP Script 2.0.0
*
* Copyright 2012, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
*/
@wecodelaravel
wecodelaravel / MimeTypes.php
Created September 13, 2018 23:24 — forked from kongondo/MimeTypes.php
List of MimeTypes mapped to file extensions
<?php
// I made this array by joining all the following lists + .php extension which is missing in all of them.
// please contribute to this list to make it as accurate and complete as possible.
// https://gist.github.com/plasticbrain/3887245
// http://pastie.org/5668002
// http://pastebin.com/iuTy6K6d
// total: 1223 extensions as of 16 November 2015
$mime_types = array(
'3dm' => array('x-world/x-3dmf'),
'3dmf' => array('x-world/x-3dmf'),
@wecodelaravel
wecodelaravel / MediaVideoConverterListener.php
Created November 28, 2018 23:53 — forked from Nks/MediaVideoConverterListener.php
Laravel Media Library converting video to .mp4 after saving
<?php
namespace App\Listeners;
use App\Media;
use FFMpeg\FFMpeg;
use FFMpeg\Format\Video\X264;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\SerializesModels;
<script type = 'application/ld+json' class = 'yoast-schema-graph yoast-schema-graph--main'> {
"@context": "https://schema.org",
"@graph": [{
"@type": "Organization",
"@id": "https://yoast.com/#organization",
"name": "Yoast",
"url": "https://yoast.com/",
"sameAs": ["https://www.facebook.com/yoast", "https://www.instagram.com/yoast/", "https://www.linkedin.com/company/1414157/", "https://www.youtube.com/yoast", "https://www.pinterest.com/yoast/", "https://en.wikipedia.org/wiki/Yoast", "https://twitter.com/yoast"],
"logo": {
"@type": "ImageObject",
<script type = 'application/ld+json' class = 'yoast-schema-graph yoast-schema-graph--main'> {
"@context": "https://schema.org",
"@graph": [{
"@type": "Organization",
"@id": "https://yoast.com/#organization",
"name": "Yoast",
"url": "https://yoast.com/",
"sameAs": ["https://www.facebook.com/yoast", "https://www.instagram.com/yoast/", "https://www.linkedin.com/company/1414157/", "https://www.youtube.com/yoast", "https://www.pinterest.com/yoast/", "https://en.wikipedia.org/wiki/Yoast", "https://twitter.com/yoast"],
"logo": {
"@type": "ImageObject",
@wecodelaravel
wecodelaravel / add-yoast-seo-data-to-WP-REST-API.php
Created May 7, 2019 01:29 — forked from ccurtin/add-yoast-seo-data-to-WP-REST-API.php
Add 'yoast' SEO data to the REST API w/ og & twitter meta fallbacks...
<?php
/*
Creates and end-point that get Yoast SEO meta tags...
*/
add_action('rest_api_init', 'add_yoast_data');
function add_yoast_data()
{
// Add your post types here...
register_rest_field(array(
@wecodelaravel
wecodelaravel / wp-yoast-hooks.php
Created May 7, 2019 01:30 — forked from hearvox/wp-yoast-hooks.php
Hooks to disable Yoast SEO plugin features and admin screen controls.
<?php
/*******************************
=Yoast SEO Hooks (includes Premium)
******************************/
/* Remove default redirects feature, for posts and term.
* @link https://kb.yoast.com/kb/how-to-disable-automatic-redirects/
*/
add_filter('wpseo_premium_post_redirect_slug_change', '__return_true' );
add_filter('wpseo_premium_term_redirect_slug_change', '__return_true' );
<ol>
<?php
/* Remove duplicate meta, in this case Author and Contact (custom tax) */
// Get all posts assigned a term in a specific custom taxonomy.
$tax = 'contact';
$args = array(
'post_type' => 'post',
'posts_per_page' => 1000,
'orderby' => 'ID',