Skip to content

Instantly share code, notes, and snippets.

@dikiyforester
dikiyforester / class-view-listing-single.php
Created November 24, 2018 07:09
Redirect Expired ClassiPress Ad Listings to Home Page
<?php
/**
* Single Listing view.
*/
class DKF_REL_View_Listing_Single extends APP_View {
/**
* Check if this class should handle the current view.
*
* @return bool
@dikiyforester
dikiyforester / custom-import.php
Last active November 16, 2018 05:02
Programmatically Import/export data from the Vantage listings
<?php
function va_custom_import() {
global $vantage;
/**
* 1. Insert & Update listing data.
*
* If you specify listing ID - it will update that listing, otherwise it
* will insert new one.
*
@dikiyforester
dikiyforester / widget-latest-ad_listing.php
Created October 22, 2018 05:56
Template to display widget "Vantage - Home Latest Listings" always in a List view
<?php
/**
* Template to display widget "Vantage - Home Latest Listings".
*
* @package Vantage\Templates
* @since 4.0.0
*/
$items = $instance['items'];
set_query_var( 'listing_layout', 'list' );
@dikiyforester
dikiyforester / sub-category-mega-menu.php
Created September 23, 2018 07:36
Appends the listing sub categories mega menu to the category menu item.
<?php
/**
* Appends the listing sub categories mega menu to the category menu item.
*
* @param string $item_output The menu item's starting HTML output.
* @param object $item Menu item data object.
* @param int $depth Depth of menu item. Used for padding.
* @param array $args An array of wp_nav_menu() arguments.
*/
function va_sub_category_mega_menu( $item_output, $item, $depth, $args ) {
@dikiyforester
dikiyforester / searchform-listing.php
Last active July 17, 2018 14:08
Replace ClassiPress Location Search field with States dropdown
<?php
/**
* The listing search form template file
*
* @package ClassiPress
* @since 4.0.0
*/
if ( ! isset( $search_form_location ) ) {
$search_form_location = 'bar';
@dikiyforester
dikiyforester / class-step-explain-claim.php
Created June 16, 2018 11:57
The listing process step class to add explaining step at the beginning of the Claim Listing process.
<?php
class MY_Step_Explain_Claim extends APP_Listing_Step {
/**
* Construct Listing step
*
* @param APP_Listing $listing Listing object to assign step with.
* @param string $step_id Step ID.
* @param array $args Optional. An array of arguments.
*/
public function __construct( APP_Listing $listing, $step_id = 'explain', $args = array() ) {
@dikiyforester
dikiyforester / wpnew
Last active May 24, 2018 07:24
Bash script to create a new fresh WordPress site install within a network (using wp cli)
#!/bin/bash
if [ $# -lt 1 ]; then
echo "usage: $(basename $0) <new-site-slug> [<theme-slug>, <plugin-slug>]"
exit 1
fi
wp site delete --slug="$1"
wp site create --slug="$1"
@dikiyforester
dikiyforester / get-word-count.php
Last active May 12, 2018 09:44
Return information about words used in a string prior PHP 5.3
<?php
/**
* Counts words in a text string.
*
* Uses code from wp_trim_words().
*
* @param string $text Given text.
*/
function my_get_word_count( $text = '' ) {
$translations = get_translations_for_domain( 'default' );
@dikiyforester
dikiyforester / disable-expire-listing-email.php
Created April 20, 2018 15:50
Disables Expired Listing email
<?php
/*
* Plugin Name: Disable Expired Listing Email
* Description: Disable Expired Listing Email
* Version: 1.0.0
* Author: Artem Frolov (dikiyforester)
* Author URI: https://www.appthemes.com/members/dikiyforester/
*/
function my_appthemes_notify_user_expired_listing( $args ) {
@dikiyforester
dikiyforester / clipper-custom-taxonomy.php
Created February 8, 2018 18:03
Registers custom Banks and Brands taxonomies for the AppThemes Clipper Coupons
<?php
/*
* Plugin Name: Clipper Custom Taxonomies
* Description: Registers custom Banks and Brands taxonomies for the Clipper Coupons.
* Version: 1.0.0
* Author: Artem Frolov (dikiyforester)
* Author URI: https://www.appthemes.com/members/dikiyforester/
* Text Domain: clipper-custom-taxonomies
*/