Skip to content

Instantly share code, notes, and snippets.

View dhirenpatel22's full-sized avatar
🏠
Working from home

Dhiren Patel dhirenpatel22

🏠
Working from home
View GitHub Profile
@dhirenpatel22
dhirenpatel22 / attach-pdf-file-in-cf7-email.php
Created February 25, 2018 12:07
Attaching a PDF file in Contact Form 7 email notification
<?php
/**
* Attaching a PDF file in Contact Form 7 email notification
* @author Dhiren Patel
* @link http://www.dhirenpatel.me/attach-pdf-file-in-cf7-email/
*/
add_filter( 'wpcf7_mail_components', 'mycustom_wpcf7_mail_components' );
function mycustom_wpcf7_mail_components( $components ) {
$components['attachments'][] = get_template_directory().'/pdf/test.pdf'; // PDF Path
return $components;
@dhirenpatel22
dhirenpatel22 / display-read-link-wordpress-excerpts.php
Created February 25, 2018 12:10
Display a Read More link in WordPress Excerpts
@dhirenpatel22
dhirenpatel22 / how-to-move-comment-textarea-to-bottom-in-wordpress.php
Last active February 25, 2018 12:11
How to Move Comment Textarea to Bottom in WordPress?
<?php
/**
* How to Move Comment Textarea to Bottom in WordPress
* @author Dhiren Patel
* @link http://www.dhirenpatel.me/how-to-move-comment-textarea-to-bottom-in-wordpress/
*/
function wpb_move_comment_field_to_bottom( $fields ) {
$comment_field = $fields['comment'];
unset( $fields['comment'] );
$fields['comment'] = $comment_field;
@dhirenpatel22
dhirenpatel22 / five-columns-bootstrap3.css
Created February 25, 2018 12:13
How to create five equal columns in Bootstrap 3 ?
/**
* How to create five equal columns in Bootstrap 3?
* @author Dhiren Patel
* @link http://www.dhirenpatel.me/create-five-equal-columns-bootstrap-3/
*/
.col-xs-55, .col-sm-55, .col-md-55, .col-lg-55{
position: relative;
min-height: 1px;
padding-right: 10px;
@dhirenpatel22
dhirenpatel22 / cpt-wordpress-search-result.php
Created February 25, 2018 12:15
How to include Custom Post Type in WordPress Search Result ?
<?php
/**
* This function modifies the main WordPress query and includes an array of
* post types instead of the default 'post' and 'page' post type.
*
* @param object $query The original query.
* @return object $query The amended query.
*/
function include_cpt_search( $query ) {
@dhirenpatel22
dhirenpatel22 / wc-checkout-bootstrap.php
Created February 25, 2018 15:22
Add Bootstrap Class to WooCommerce Checkout Fields
<?php /**
* Add Bootstrap Class to WooCommerce Checkout Fields
* @author Dhiren Patel
* @link http://www.dhirenpatel.me/wc-checkout-bootstrap/
*/
add_filter('woocommerce_form_field_args', 'wc_form_field_args',10,3);
function wc_form_field_args($args, $key, $value) {
$args['input_class'] = array( 'form-control' );
return $args;
@dhirenpatel22
dhirenpatel22 / get-woocommerce-urls.php
Last active February 25, 2018 16:45
How to get various URL of all WooCommerce pages?
<?php /**
* How to get various URL of all WooCommerce pages?
* @author Dhiren Patel
* @link http://www.dhirenpatel.me/get-various-url-woocommerce-pages/
*/
// Get the Shop page url
echo get_permalink( wc_get_page_id( 'shop' ) );
// Get the My Account page url
@dhirenpatel22
dhirenpatel22 / save-ftp-wordpress.php
Created March 30, 2018 09:49
How to save FTP details in WordPress website?
<?php /**
* How to save FTP details in WordPress website?
* @author Dhiren Patel
* @link http://www.dhirenpatel.me/how-to-save-ftp-details-in-wordpress-website-quicktip/
*/
/** Setup FTP Details **/
define("FTP_HOST", "localhost");
define("FTP_USER", "your-ftp-username");
define("FTP_PASS", "your-ftp-password");
@dhirenpatel22
dhirenpatel22 / secure-ftp-wordpress.php
Created March 30, 2018 09:52
Secure FTP Connection in WordPress
<?php /**
* Secure FTP Connection in WordPress
* @author Dhiren Patel
* @link http://www.dhirenpatel.me/how-to-save-ftp-details-in-wordpress-website-quicktip/
*/
// Secure Connection
define('FTP_SSL', true);
@dhirenpatel22
dhirenpatel22 / direct-ftp-access-wordpress.php
Created March 30, 2018 09:55
Enable Direct FTP Access in WordPress
<?php /**
* Enable Direct FTP Access in WordPress
* @author Dhiren Patel
* @link http://www.dhirenpatel.me/how-to-save-ftp-details-in-wordpress-website-quicktip/
*/
// Direct FTP Access
define('FS_METHOD', 'direct');