Skip to content

Instantly share code, notes, and snippets.

@vural
vural / megep.md
Last active Oct 3, 2020
Megep Dökümanları - 1. Liste
@bainternet
bainternet / custom-cf7-tags.php
Created Aug 9, 2011
custom contact form 7 tags
View custom-cf7-tags.php
<?php
//contact form 7 extras
//author email
wpcf7_add_shortcode('expert_email', 'wpcf7_expert_email_shortcode_handler', true);
function wpcf7_expert_email_shortcode_handler($tag) {
if (!is_array($tag)) return '';
$name = $tag['name'];
if (empty($name)) return '';
@mustafauysal
mustafauysal / .htaccess
Last active Jun 29, 2018
uploads from production server
View .htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{HTTP_HOST} ^localsite\.test$
RewriteRule ^wp-content/uploads/(.*)$ https://example.com/wp-content/uploads/$1 [NC,L]
</IfModule>
@mustafauysal
mustafauysal / br.php
Created Sep 13, 2013
please don't break me!
View br.php
<?php
add_filter('the_content', 'remove_br_tags');
function remove_br_tags($content) {
return preg_replace('/<br(\s+)?\/?>/i', "\n", $content);
}
@borantula
borantula / get_oembed.php
Created Jun 17, 2014
WordPress Oembed Html from Url
View get_oembed.php
<?php
function getOembedHtml($url,$width,$height)
{
require_once( ABSPATH . WPINC . '/class-oembed.php' );
$oembed = _wp_oembed_get_object();
$html = $oembed->get_html($url,array('width' => (int)$width,'height' => (int)$height) );
return $html;