This file contains 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
# BEGIN Cache Enabler | |
# | |
# This version is meant for Apache 2.3.9 or later. | |
# | |
# Reference: https://www.keycdn.com/support/wordpress-cache-enabler-plugin#apache | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
# set blog sub path |
This file contains 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 | |
add_filter( 'carbon_fields_attachment_id_from_url' , __NAMESPACE__ . '\get_attachment_id_from_url', 10, 2 ); | |
function get_attachment_id_from_url( $attachment_id, $url ) { | |
if ( 0 === $attachment_id ) { | |
$dir = wp_upload_dir(); | |
$filename = basename( $url ); | |
$filename = str_replace( [ '.doc', '.pdf', '.xls' ], [ '-doc', '-pdf', '-xls' ], $filename ); | |
$filename .= '.jpg'; |
OlderNewer