Skip to content

Instantly share code, notes, and snippets.

FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'
<?php if ( get_field( 'schede_prodotti' ) ): ?>
<table class="product-list simple-list">
<?php
$ids = array(); // Empty array for the $post->IDs from the relationship fields
$files = array(); // Empty array for the files from the repeater fields
while( has_sub_field( 'schede_prodotti' ) ):
/**
<?php
/**
* Change text strings
*
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
*/
function my_text_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Sale!' :
$translated_text = __( 'Clearance!', 'woocommerce' );
<!DOCTYPE html>
<meta charset="utf-8">
<title>Superformula</title>
<style>
path {
stroke-width: 1.5px;
stroke: #666;
fill: #ddd;
}
(function() {
var root = this;
var previousSuperformula = root.Superformula;
var NP = 360, phi = Math.PI * 2 / NP;
var Superformula = root.Superformula = function(m, n1, n2, n3) {
<?php if ( is_home() ) : ?>
<h2><?php echo the_title(); ?></h2>
<?php elseif ( is_search() ): ?>
<h1><?php
$search_count = 0;
$search = new WP_Query("s=$s&showposts=-1");
if($search->have_posts()) {
while($search->have_posts()) {
$search->the_post();
$search_count++;
<?php
/**
* Save custom attachment meta
*
* @see wp_ajax_save_attachment_compat(), media_upload_form_handler(), edit_post()
*
* @param array $post The attachment attributes.
* @param array $attachment_data An array of attachment fields.
*
* @return array The attachment attributes.
<?php function sz_get_testimonials( $page_id ){
$testimonials = get_post_meta( $page_id, 'testimonial', false );
if ( $testimonials ) {
$testimonial_list = "\n<ul>\n";
foreach ( $testimonials as $testimonial ) {
$testimonial_image = false;
$testimonial_content = false;
$testimonial_list .= "\t<li class='row'>";
if ( $testimonial['testimonial-image'] ) {
$testimonial_image = wp_get_attachment_image( $testimonial['testimonial-image'], 'full', '', array( 'class' => 'columns small-3' ) );
// join term_relationships and term_taxonomy
add_filter( 'getarchives_join', 'customarchives_join' );
// add where condition for category
add_filter( 'getarchives_where', 'customarchives_where' );
// add where condition for date
add_filter('getarchives_where','filter_until_year_archives');
function customarchives_join($join_clause) {
global $wpdb;
return $join_clause." INNER JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)";