Plugin update “Could not create directory” fix on ubuntu server

Login on ssh with root user & run command below

chown -R www-data:www-data /var/www/path-to-wp-directory

sudo find /var/www/path-to-wp-directory/ -type d -exec chmod 755 {} \;

sudo find /var/www/path-to-wp-directory/ -type f -exec chmod 644 {} \;

11,013 Views

Gravity form popup with bootstrap modal

function gf_popup_shortcode( $atts, $content = null  ) {

	extract( shortcode_atts( array(
		'title' => '',
		'id' => '',
		'text' => '',
	), $atts ) );

	return '
        <a class="gf-form-modal-trigger" href="" data-toggle="modal" data-target="#gf-popup-modal'.$id.'">'.$text.'</a>
        <div class="modal fade" id="gf-popup-modal'.$id.'" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title" id="myModalLabel">'.$title.'</h4>
                    </div>
                    <div class="modal-body">
                        '.do_shortcode('[gravityform id="'.$id.'" title="false" description="false" ajax="true"]').'
                    </div>
                </div>
            </div>
        </div>
    ';
}	
add_shortcode('gf_popup', 'gf_popup_shortcode');
58,065 Views

Simple php server to server file download script

<?php
set_time_limit(0); //Unlimited max execution time
 
$path = 'archive.zip';
$url = 'http://google.com/archive.zip';
$newfname = $path;
echo 'Starting Download!<br>';
$file = fopen ($url, "rb");
if($file) {
	$newf = fopen ($newfname, "wb");
	if($newf)
		while(!feof($file)) {
			fwrite($newf, fread($file, 1024 * 8 ), 1024 * 8 );
			echo '1 MB File Chunk Written!<br>';
		}
}
if($file) {
	fclose($file);
}
if($newf) {
	fclose($newf);
}
echo 'Finished!';
?>
85,252 Views

Woocommerce get price in custom loop

<?php
global $woocommerce;
$currency = get_woocommerce_currency_symbol();
$price = get_post_meta( get_the_ID(), '_regular_price', true);
$sale = get_post_meta( get_the_ID(), '_sale_price', true);
?>

<?php if($sale) : ?>
<p class="product-price-tickr"><del><?php echo $currency; echo $price; ?></del> <?php echo $currency; echo $sale; ?></p>    
<?php elseif($price) : ?>
<p class="product-price-tickr"><?php echo $currency; echo $price; ?></p>    
<?php endif; ?>
86,063 Views

Dynamic Popup social share with font awesome

<a class="facebook-share" onClick="window.open('http://www.facebook.com/sharer.php?u=<?php echo site_url();?>','Facebook','width=600,height=300,left='+(screen.availWidth/2-300)+',top='+(screen.availHeight/2-150)+''); return false;" href="http://www.facebook.com/sharer.php?u=<?php echo site_url();?>"><i class="fa fa-facebook"></i></a>                            

<a class="twitter-share" onClick="window.open('http://twitter.com/share?url=<?php echo site_url();?>&amp;text=<?php bloginfo('title'); ?>','Twitter share','width=600,height=300,left='+(screen.availWidth/2-300)+',top='+(screen.availHeight/2-150)+''); return false;" href="http://twitter.com/share?url=<?php echo site_url();?>&amp;text=<?php echo str_replace(" ", "%20", bloginfo('title')); ?>"><i class="fa fa-twitter"></i></a> 

<a class="google-plus-share" onClick="window.open('https://plus.google.com/share?url=<?php echo site_url();?>','Google plus','width=585,height=666,left='+(screen.availWidth/2-292)+',top='+(screen.availHeight/2-333)+''); return false;" href="https://plus.google.com/share?url=<?php echo site_url();?>"><i class="fa fa-google-plus"></i></a> 

<a class="pinterest-share" href='javascript:void((function()%7Bvar%20e=document.createElement(&apos;script&apos;);e.setAttribute(&apos;type&apos;,&apos;text/javascript&apos;);e.setAttribute(&apos;charset&apos;,&apos;UTF-8&apos;);e.setAttribute(&apos;src&apos;,&apos;http://assets.pinterest.com/js/pinmarklet.js?r=&apos;+Math.random()*99999999);document.body.appendChild(e)%7D)());'><i class="fa fa-pinterest"></i></a>
125,579 Views
Page 1 of 2512345...1020...Last »