Skip to content

Instantly share code, notes, and snippets.

@vralle
vralle / seo-wc.php
Last active Dec 30, 2020
The SEO Framework - Exclude WooCommerce account pages from SEO and Sitemap
View seo-wc.php
<?php
/**
* Alternative option. Stop TSF meta output using a function and add meta tag for robots.
*/
public function __construct() {
add_filter( 'the_seo_framework_query_supports_seo', array( $this, 'stop_tsf_meta_output' ) );
add_filter( 'the_seo_framework_sitemap_hpt_query_args', array( $this, 'wc_no_sitemap' ) );
add_action( 'wp_head', array( $this, 'no_robots_tag_on_private_pages' ), 1 );
}
@vralle
vralle / amp-images-map.php
Last active Feb 10, 2019
A map of amp images output:
View amp-images-map.php
/**
* Single image
* @link https://ampbyexample.com/components/amp-img/
*/
$single_image = array(
'element' => 'amp-img',
'attributes' => array(),
);
/**
@vralle
vralle / gallery.php
Last active Jan 13, 2019
Custom Gallery Shortcode output
View gallery.php
@vralle
vralle / gist:86f62b6a005502ac8ead8fc14ee65b30
Created Apr 16, 2018
WP ClI Search and replace in database on network
View gist:86f62b6a005502ac8ead8fc14ee65b30
wp search-replace old_string new_string wp_*post* --include-columns=post_content --dry-run --network
@vralle
vralle / admin.js
Last active Mar 26, 2018
Adding a Media Button to the WordPress Editor.
View admin.js
jQuery(function($) {
$(document).ready(function(){
$('#insert-my-media').click(open_media_window);
});
function open_media_window() {
if (this.window === undefined) {
this.window = wp.media({
title: 'Insert a media',
library: {type: 'image'},
@vralle
vralle / admin.js
Last active Nov 23, 2015
Insert embed image as Shortcode by WP Media
View admin.js
// ### Convert an HTML-representation of an object to a string.
function myHTML() {
// Save default function
var defaultHTML = wp.html.string;
// image intercept
wp.html.string = function( options ) {
// If image, send new function
if( 'img' === options.tag ) {
return shortcake.html( options );
}
@vralle
vralle / img-shortcode.php
Last active Dec 12, 2015
Image Shortcode: Return images with WP markup
View img-shortcode.php
<?php namespace Vralle\Plugin\Shortcode\Img;
/*-------------------------------------------------------------------
* Register UI
*-----------------------------------------------------------------*/
function editor_ui() {
global $_wp_additional_image_sizes;
$default_sizes = [
@vralle
vralle / converter.php
Last active Dec 12, 2015
Convert images to Shortcode
View converter.php
<?php namespace Vralle\Plugin\Shortcode\Img;
/*-------------------------------------------------------------------
* Convert images to Shortcode
*-----------------------------------------------------------------*/
function html_to_shortcode( $content ) {
// Returns, if content is empty
if( empty( $content ) ) return $content;
if( 'content_save_pre' === current_filter() )
@vralle
vralle / image-shortcake-admin.js
Last active Nov 22, 2015
Image-Shortcake: Fix 'media_send_to_editor' for WP Insert Media
View image-shortcake-admin.js
function myTest() {
// Save default function
var defaultSend = wp.media.editor.send.attachment;
// new send function
wp.media.editor.send.attachment = function( props, attachment) {
// If not image, return default function
if ( 'image' !== attachment.type )
return defaultSend( props, attachment)
@vralle
vralle / Bootstrap Modal and popover with Velocity.js animation.markdown
Created Jul 15, 2015
Bootstrap Modal and popover with Velocity.js animation
View Bootstrap Modal and popover with Velocity.js animation.markdown