Skip to content

Instantly share code, notes, and snippets.

@ajaydsouza
ajaydsouza / crp-vertical.css
Last active November 6, 2017 22:42
Contextual Related Posts styles
/* Vertical Related Posts */
/* The full list */
.crp_related ul li {
list-style-type:none;
/* float:left; */
margin:0 40px 0 0;
width: 230px;
}
@ajaydsouza
ajaydsouza / better-search-polylang.php
Last active April 25, 2020 18:18
Better Search and Polylang compatibility
<?php
// Doesn't work.
/**
* Joins the taxonomy tables. Filters bsearch_posts_join.
*
* @param string $join
* @return string
*/
@ajaydsouza
ajaydsouza / Install automysqlbackup.md
Last active December 12, 2016 21:46 — forked from janikvonrotz/Install automysqlbackup.md
Ubuntu: Install automysqlbackup#MySQL#Markdown

Introduction

AutoMySQLBackup with a basic configuration will create Daily, Weekly and Monthly backups of one or more of your MySQL databases from one or more of your MySQL servers.

Requirements

  • Ubuntu server
  • MySQL

Installation

@ajaydsouza
ajaydsouza / delete-old-post-meta.mysql
Last active June 14, 2017 07:09
Delete old wp post meta entries
DELETE FROM `wp_postmeta`
where meta_key LIKE '_su_%'
OR meta_key LIKE '_aioseop_%'
OR meta_key LIKE '_sexybookmarks_%'
OR meta_key LIKE '%SexyBookmarks%'
OR meta_key LIKE '%OgTags%'
OR meta_key LIKE 'digg'
OR meta_key LIKE 'ratings_%'
OR meta_key LIKE '_utw_%'
OR meta_key LIKE 'dsq_%'
@ajaydsouza
ajaydsouza / crp-same-post-type.php
Created March 28, 2016 16:25
CRP - Limit to same post type
<?php
/**
* Filter the post types to limit it to the same post type.
*
* @param array $post_types Array of post types included in WHERE clause
* @return array Updated array of post types
*/
function crp_same_post_type( $post_types ) {
global $post;
@ajaydsouza
ajaydsouza / bsearch-examples.php
Created December 26, 2015 21:06
Examples of using various filters in Better Search WordPress plugin
<?php
/**
* Filter to override the censor character in Better Search.
*
* @param string Default censor string
*
* @return string Censored string
*/
function filter_bsearch_censor_char( $censorChar ) {
return "*";
@ajaydsouza
ajaydsouza / same-language.php
Last active September 26, 2015 00:34
CRP / Top 10 - WPML functions
<?php
/**
* This function forces all related / top ten posts are from the same language.
*
* @param bool $return_original_if_missing
*/
function filter_return_ori( $return_original_if_missing ) {
return true;
}
@ajaydsouza
ajaydsouza / bsearch-meta-field.php
Last active June 15, 2018 09:18
Better Search API Examples
<?php
// Fixes to disregard Hidden products and to add Author Billing field to Better Search plugin queries
function filter_bsearch_posts_join( $join ) {
global $wpdb, $author_search;
$join .= "
INNER JOIN $wpdb->postmeta AS pm ON ($wpdb->posts.ID = pm.post_id)
";
if ( $author_search ) {
$join .= "
INNER JOIN $wpdb->postmeta AS pma ON ($wpdb->posts.ID = pma.post_id)
@ajaydsouza
ajaydsouza / clean-files.sh
Created June 30, 2015 13:23
Delete DS_Store & Thumbs.db
sudo find . -name '*.DS_Store' -type f -delete
sudo find . -name 'Thumbs.db' -type f -delete
@ajaydsouza
ajaydsouza / rsync.sh
Last active March 29, 2016 09:34
rsync basic syntax
rsync -va --progress SourceFolder DestinationFolder