Skip to content

Instantly share code, notes, and snippets.

View k33n's full-sized avatar
🎯
Focusing

Michael Keene k33n

🎯
Focusing
View GitHub Profile
<article class="m-article" v-for="post in posts">
<div class="m-media">
<a v-bind:href="post.link">
<template v-if="post._embedded['wp:featuredmedia']">
<img :src="post._embedded['wp:featuredmedia'][0].source_url" alt="">
</template>
</a>
</div>
<div class="m-txts">
<a v-bind:href="post.link">
@woogists
woogists / wc-display-my-account-template.php
Last active November 30, 2021 10:38
[Theming Snippets] Display my-account link in a template file
<?php if ( is_user_logged_in() ) { ?>
<a href="<?php echo get_permalink( get_option('woocommerce_myaccount_page_id') ); ?>" title="<?php _e('My Account','woothemes'); ?>"><?php _e('My Account','woothemes'); ?></a>
<?php }
else { ?>
<a href="<?php echo get_permalink( get_option('woocommerce_myaccount_page_id') ); ?>" title="<?php _e('Login / Register','woothemes'); ?>"><?php _e('Login / Register','woothemes'); ?></a>
<?php } ?>
@jfarsen
jfarsen / functions.php
Created August 9, 2017 01:37
Remove Divi shortcodes from content
<?php
/**
* Remove Divi shortcodes from content
*
* @see http://victorfont.com/remove-divi-shortcodes-changing-themes/
*/
function remove_divi_shortcodes( $content ) {
$content = preg_replace('/\[\/?et_pb.*?\]/', '', $content);
return $content;
@srmds
srmds / Installing wkhtmltopdf 0.12.6, 0.12.5, 0.12.4 - Ubuntu 22.06 , 18.04, 16.04 x64, 0.12.6 - MacOS Ventura 13.6.md
Last active February 16, 2024 13:54
Installing wkhtmltopdf 0.12.4, 0.12.5 0.12.6 - Ubuntu 22.04 - 0.12.6, 16.04 x64, 0.12.5 - Ubuntu 18.04 x64 - 0.12.5 - macOS Ventura -13.6
@sonnygauran
sonnygauran / database-tables-size.sql
Created February 5, 2017 12:27
Show current database's table sizes in descending order. Usually ran inside Sequel Pro Based on http://stackoverflow.com/questions/9620198/how-to-get-the-sizes-of-the-tables-of-a-mysql-database.
SET @table=(SELECT DATABASE());
select @table;
SELECT
table_schema as `Database`,
table_name AS `Table`,
round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB`
FROM information_schema.TABLES
WHERE table_schema = @table
ORDER BY (data_length + index_length) DESC;
@kylephillips
kylephillips / simple-locator-dynamic-population.php
Created December 20, 2016 18:05
Populate and submit a simple locator form dynamically and automatically on page load, using a GET parameter
<?php
/**
* Using this method, a GET parameter can be passed to the page, enabling a simple locator form to be populated and submitted dynamically.
* One use case may exist where the user submits a gravity form, and is redirected to a list of locations without needing to resubmit the simple locator form.
* This code would be placed in a page template.
*/
// First, we check if a GET parameter named "search" exists. If so, we sanitize it and set it for our use
// This could be passed via a link, or through another form submission
$location_search = ( isset($_GET['search']) ) ? sanitize_text_field($_GET['search']) : false;
@samrap
samrap / setup.php
Last active June 21, 2017 17:28
Fix acf-json for Roots Sage 9
<?php
/**
* Fix location of ACF local JSON.
*
* Since Sage does some surgery on the WordPress template locations, ACF looks in
* the wrong location for the acf-json directory. We will fix this by manually
* hooking into that functionality and attempting to save in the right spot.
*
* @param string $path
@derekshirk
derekshirk / acf-inline-svg.php
Created July 20, 2016 22:14
Output Inline SVGs from ACF image field
<?php
/* ————————————————————————— */
/* ACF Inline SVGs
/* ————————————————————————— */
$repeater = 'repeater_field_name'
if ( have_rows( $repeater ) ): ?>
<section class="content-main">
<div class="container"> <?php
@dillinghamio
dillinghamio / @role.md
Last active April 20, 2021 00:39
@ROLE Blade Directive For Laravel Spark

@role Blade Directive For Laravel Spark

Assumes you're using teams

Add this to the boot() method of your AppServiceProvider

\Blade::directive('role', function($roles) {

 $user = auth()-&gt;user();
@ethicka
ethicka / wp-start.sh
Last active December 27, 2023 07:10
WordPress Installation with the Roots/Sage Framework and VirtualHost Creation
#!/bin/bash -e
##
# WordPress Installation and VirtualHost Creation
#
# Description: Installs a WordPress website in the ~/Sites folder, creates a homepage,
# cleans up the WP install a bit, deletes the akismet and hello dolly plugins, creates the permalinks,
# clones the roots/sage theme framework to the theme folder, deletes all the other WP default themes,
# installs/runs npm and bower and runs gulp to create the initial assets, adds a custom gitignore file
# to /wp-content, installs the roots/soil plugin, creates a git repo in wp-content, saves the WordPress