Skip to content

Instantly share code, notes, and snippets.

View AnkanSoul's full-sized avatar

Ankan Chakraborty AnkanSoul

  • IGI
  • Durgapur
View GitHub Profile
@AnkanSoul
AnkanSoul / Post timing
Created April 25, 2018 15:44
Post timing
--------------------Post timing ago----------------------
function time_ago( $type = 'post' ) {
$d = 'comment' == $type ? 'get_comment_time' : 'get_post_time';
return human_time_diff($d('U'), current_time('timestamp')) . " " . __('ago');
}
<?php echo time_ago(); ?>
@AnkanSoul
AnkanSoul / Nav menu container false
Created April 25, 2018 15:43
Nav menu container false
======================= Nav menu container false ==========
add_filter('wp_nav_menu_args', 'prefix_nav_menu_args');
function prefix_nav_menu_args($args = ''){
$args['container'] = false;
return $args;
}
===========================
@AnkanSoul
AnkanSoul / Pagination
Created April 25, 2018 15:43
Pagination
<?php
if (get_query_var('paged')) {
$paged = get_query_var('paged');
}
elseif (get_query_var('page')) {
$paged = get_query_var('page');
} else {
$paged = 1;
}?>
@AnkanSoul
AnkanSoul / gist:ced884cd68598c557caf26667b2635ea
Created April 25, 2018 15:41
How to initialize Template Name
<?php
/**
* Template Name: blog
*
* @package project2
* @subpackage project2
* @since project2
*/
get_header()
@AnkanSoul
AnkanSoul / WP Bootstrap Navwalker
Created April 25, 2018 15:41
WP Bootstrap Navwalker
<?php
/**
* WP Bootstrap Navwalker
*
* @package WP-Bootstrap-Navwalker
*/
/**
* Class Name: WP_Bootstrap_Navwalker
* Plugin Name: WP Bootstrap Navwalker
@AnkanSoul
AnkanSoul / comment blog section removed url field
Created April 25, 2018 15:40
comment blog section removed url field
======================= comment blog section removed url field ==============================================
function wpb_disable_comment_url($fields)
{
unset($fields['url']);
return $fields;
}
add_filter('comment_form_default_fields','wpb_disable_comment_url');
@AnkanSoul
AnkanSoul / Nav walker issuse for parents
Created April 25, 2018 15:39
Nav walker issuse for parents
=====Nav walker issuse for parents # =========================================================
// If item has_children add atts to a.
if ( $args->has_children && 0 === $depth ) {
$atts['href'] = ! empty( $item->url ) ? $item->url : '';
//$atts['data-toggle'] = 'dropdown';
$atts['class'] = 'dropdown-toggle';
$atts['aria-haspopup'] = 'true';
@AnkanSoul
AnkanSoul / Contact form after submit redirect for all form
Last active April 25, 2018 15:38
Contact form after submit redirect for all form
========================Contact form after submit redirect for all form===========
<script>
document.addEventListener( 'wpcf7mailsent', function( event ) {
location = 'https://wp.goigi.me/readysetboom/wp-admin/upload.php?item=146';
}, false );
</script>
@AnkanSoul
AnkanSoul / Contact Form 7 stop conflicting with other jquery
Created April 25, 2018 15:36
Contact Form 7 stop conflicting with other jquery
==========================Contact Form 7 stop conflicting with other jquery =======================================
// De-register jQuery from Contact Form 7
add_action('wp_print_scripts','my_deregister_javascript', 100);
function my_deregister_javascript() {
wp_deregister_script('contact-form-7');
}
@AnkanSoul
AnkanSoul / Woocommerce Featured Product
Created April 25, 2018 15:35
Woocommerce Featured Product