Skip to content

Instantly share code, notes, and snippets.

@ajaydsouza
ajaydsouza / rules.v4
Created July 26, 2023 20:26
Oracle iptables default rules
# CLOUD_IMG: This file was created/modified by the Cloud Image build process
# iptables configuration for Oracle Cloud Infrastructure
# See the Oracle-Provided Images section in the Oracle Cloud Infrastructure
# documentation for security impact of modifying or removing these rule
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [463:49013]
<?php
// The Query.
$the_query = new Top_Ten_Query( $args );
// The Loop.
if ( $the_query->have_posts() ) {
echo '<ul>';
while ( $the_query->have_posts() ) {
$the_query->the_post();
@ajaydsouza
ajaydsouza / standard-loop.php
Last active January 10, 2021 14:53
CRP_Query Examples
<?php
// The Query.
$the_query = new CRP_Query( $args );
// The Loop.
if ( $the_query->have_posts() ) {
echo '<ul>';
while ( $the_query->have_posts() ) {
$the_query->the_post();
@ajaydsouza
ajaydsouza / bsearch-html-markup.html
Created June 3, 2019 21:41
Better Search HTML markup
<!-- 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 December 21, 2018 18:39
Convert Top 10 count to use k, m and bn
<?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 November 18, 2018 12:38
Filter from and now date in Contextual Related Posts
<?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 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_%'