Skip to content

Instantly share code, notes, and snippets.

Ajay D'Souza ajaydsouza

Block or report user

Report or block ajaydsouza

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View bsearch-html-markup.html
<!-- This is the sample markup generated by Better Search v2.3.0 for each article entry -->
<article id="post-1011" class="bsearch-post post-1011 post type-post status-publish format-standard has-post-thumbnail hentry category-codex category-corner-case category-featured-images category-images">
<header class="bsearch-entry-header">
<h2 class="bsearch-entry-title"><a href="https://wpnetwork.local/blog/featured-image-horizontal/" rel="bookmark">Featured Image (Horizontal)</a></h2>
<p><span class="bsearch_score">Relevance: 75%</span> &nbsp;&nbsp;&nbsp;&nbsp; <span class="bsearch_date">Posted on: March 15, 2013</span></p>
</header>
<div class="bsearch-entry-content">
@ajaydsouza
ajaydsouza / tptn-restyle-count.php
Last active Dec 21, 2018
Convert Top 10 count to use k, m and bn
View tptn-restyle-count.php
<?php
/**
* Modify the display the tptn counter to show k and m instead.
*
* Add this code to your theme's functions.php file or in a file in mu-plugins.
*
* @param $string $input Formatted list count
*/
function tptn_restyle_count( $input ) {
@ajaydsouza
ajaydsouza / crp_change_query_dates.php
Created Nov 18, 2018
Filter from and now date in Contextual Related Posts
View crp_change_query_dates.php
<?php
/**
* Filter crp_posts_from_date.
*
* @param string $where The Minimum date of the WHERE clause of the query.
* @param int $id Post ID
*/
function crp_same_date_from( $where, $id ) {
global $wpdb, $post;
@ajaydsouza
ajaydsouza / crp-vertical.css
Last active Nov 6, 2017
Contextual Related Posts styles
View crp-vertical.css
/* 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
Created May 21, 2017
Better Search and Polylang compatibility
View better-search-polylang.php
<?php
/**
* Joins the taxonomy tables. Filters bsearch_posts_join.
*
* @param string $join
* @return string
*/
function filter_bsearch_posts_join( $join ) {
global $wpdb;
@ajaydsouza
ajaydsouza / Install automysqlbackup.md
Last active Dec 12, 2016 — forked from janikvonrotz/Install automysqlbackup.md
Ubuntu: Install automysqlbackup#MySQL#Markdown
View Install automysqlbackup.md

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 Jun 14, 2017
Delete old wp post meta entries
View delete-old-post-meta.mysql
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 Mar 28, 2016
CRP - Limit to same post type
View crp-same-post-type.php
<?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 Dec 26, 2015
Examples of using various filters in Better Search WordPress plugin
View bsearch-examples.php
<?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 Sep 26, 2015
CRP / Top 10 - WPML functions
View same-language.php
<?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;
}
You can’t perform that action at this time.