Skip to content

Instantly share code, notes, and snippets.

@shazdeh
shazdeh / install.php
Last active Oct 5, 2021
Run install.php to download and install latest version of WP
View install.php
<?php
$ch = curl_init();
$source = "https://wordpress.org/latest.zip";
curl_setopt( $ch, CURLOPT_URL, $source );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
$data = curl_exec ( $ch );
curl_close ( $ch );
/* save as wordpress.zip */
View velvet-blues-update-urls.php
<?php
/*
Plugin Name: Velvet Blues Update URLs
Plugin URI: http://www.velvetblues.com/web-development-blog/wordpress-plugin-update-urls/
Description: This plugin <strong>updates all urls in your website</strong> by replacing old urls with new urls. To get started: 1) Click the "Activate" link to the left of this description, and 2) Go to your <a href="tools.php?page=velvet-blues-update-urls.php">Update URLs</a> page to use it.
Author: VelvetBlues.com
Author URI: http://www.velvetblues.com/
Author Email: info@velvetblues.com
Version: 3.2.7
License: GPLv2 or later
@shazdeh
shazdeh / Fix
Last active Jun 9, 2017
Fix Velvet Blues Update URLs bug
View Fix
<?php
global $wpdb;
$wpdb->query( "UPDATE {$wpdb->postmeta} SET meta_value = Replace( meta_value, \"\n\", '' ) WHERE meta_key = '_themify_builder_settings_json'" );
View Builder https redirect
function custom_post_row_actions_https( $actions ) {
if( isset( $actions['themify-builder'] ) ) {
$actions['themify-builder'] = str_replace( 'http://', 'https://', $actions['themify-builder'] );
}
return $actions;
}
add_filter( 'post_row_actions', 'custom_post_row_actions_https', 100 );
add_filter( 'page_row_actions', 'custom_post_row_actions_https', 100 );
View Conditional loading of builder-styles.css
function tf_start_buffer() {
ob_start();
}
add_action( 'wp_head', 'tf_start_buffer', 1 );
function tf_end_buffer() {
$output = ob_get_clean();
if( preg_match( '/class=\"themify_builder_row/', $output ) ) {
$output = str_replace(
'<meta name="builder-styles-css" content="" id="builder-styles-css">',
View themify_audio_player_module
function themify_audio_player_module() {
/**
* Category list
* @var array
*/
$categories = array_merge(
array(
'off' => array(
'name' => __( 'Disable Audio Player', 'themify' ),
@shazdeh
shazdeh / functions.php
Last active Mar 30, 2016
Parallax Child theme
View functions.php
<?php
function custom_enqueue_scripts() {
wp_deregister_style( 'google-fonts' );
wp_enqueue_style( 'google-fonts', themify_https_esc('http://fonts.googleapis.com/css'). '?family=Crete+Round|Vidaloka|Alice');
}
add_action( 'wp_enqueue_scripts', 'custom_enqueue_scripts', 12 );
View module-plain-text.php
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* Module Name: Plain Text
* Description: Display plain text
*/
class TB_Plain_Text_Module extends Themify_Builder_Module {
function __construct() {
parent::__construct(array(
'name' => __('Plain Text', 'themify'),
@shazdeh
shazdeh / gist:af82edb3870b36cce3f0
Created Feb 6, 2015
WP Jalali and Polylang Compatibility
View gist:af82edb3870b36cce3f0
<?php
/*
Plugin Name: WP Jalali and Polylang Compatibility
Description: Disables WP Jalali when Farsi is not the current language.
*/
function wp_jalali_polylang_compat() {
if( ! function_exists( 'pll_current_language' ) || pll_current_language() == 'fa' )
return;
View gist:6b9c6442eab67eb13196
<?php
/*
Plugin Name: Themify WPTouch Compatibility
Description: This plugin makes Builder in Themify framework compatible with the WPTouch plugin.
*/
function themify_wptouch_compat() {
$theme_root = wp_get_theme()->get_template_directory();
if( ! is_admin()
&& wptouch_is_mobile_theme_showing()