Skip to content

Instantly share code, notes, and snippets.

@prajwal-stha
prajwal-stha / add-to-cart.php
Created September 20, 2016 15:48 — forked from claudiosanches/add-to-cart.php
WooCommerce - Template add-to-cart.php with quantity and Ajax!
<?php
/**
* Custom Loop Add to Cart.
*
* Template with quantity and ajax.
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
global $product;
@prajwal-stha
prajwal-stha / functions.php
Created September 9, 2016 01:11
Utilizing the GetText Filter
function translate_string( $translated_text, $untranslated_text, $domain ) {
if ( $translated_text == 'Related Products') {
$translated_text = __( 'Other Great Products', 'woocommerce' );
}
return $translated_text;
}
add_filter( 'gettext', 'translate_string', 15, 3 );
@prajwal-stha
prajwal-stha / .htaccess
Created September 9, 2016 01:06
Prevent search engines from indexing your site
Header set X-Robots-Tag "noindex, nofollow"
FTP Credentail:
Username: lifestone-demo.motts.co
Pwd: }WWb8XOX~ywI
Admin Credentails:
Username: admin
Pwd: 123goldkist
@prajwal-stha
prajwal-stha / .htaccess
Created August 5, 2016 01:28
.htaccess file to remove "public" from url
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
//Disable PHP Execution
<Files *.php>
Order Allow, Deny
Deny from all
</Files>
<Files xmlrpc.php>
Order Allow,Deny
Deny from all
</Files>
# Change the memory for the php run
php -dmemory_limit=1G bin/magento setup:install
<?php
// This will occur when the comment is posted
function theme-slug_comment_post( $incoming_comment ) {
// convert everything in a comment to display literally
$incoming_comment['comment_content'] = htmlspecialchars($incoming_comment['comment_content']);
// the one exception is single quotes, which cannot be #039; because WordPress marks it as spam
$incoming_comment['comment_content'] = str_replace( "'", '&apos;', $incoming_comment['comment_content'] );
return( $incoming_comment );
}
// This will occur before a comment is displayed
vc_map( array(
"name" => esc_html__("Project Counter", 'danfe'),
"base" => "danfe_display_counter",
"category" => esc_html__('Danfe','danfe'),
"params" => array(
array(
'type' => 'textfield',
'heading' => esc_html__('Title', 'danfe'),
'param_name' => 'section_title',
'value' => '',