This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function find_nearest_image_size( $attachment_id, $width, $height ) : string { | |
$image_meta = wp_get_attachment_metadata( $attachment_id ); | |
$size = ''; | |
if ( ! empty( $image_meta['sizes'] ) ) { | |
$last_pixel_count = 0; | |
foreach ( $image_meta['sizes'] as $key => $value ) { | |
/* image size is smaller than what we need, skip */ | |
if ( $width > $value['width'] || $height > $value['height'] ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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: [email protected] | |
Version: 3.2.7 | |
License: GPLv2 or later |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
global $wpdb; | |
$wpdb->query( "UPDATE {$wpdb->postmeta} SET meta_value = Replace( meta_value, \"\n\", '' ) WHERE meta_key = '_themify_builder_settings_json'" ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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">', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function themify_audio_player_module() { | |
/** | |
* Category list | |
* @var array | |
*/ | |
$categories = array_merge( | |
array( | |
'off' => array( | |
'name' => __( 'Disable Audio Player', 'themify' ), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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'), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; |
NewerOlder