Skip to content

Instantly share code, notes, and snippets.

View dasbairagya's full-sized avatar
🎯
Focusing

Gopal Dasbariagya dasbairagya

🎯
Focusing
View GitHub Profile
@dasbairagya
dasbairagya / functions.php
Last active July 5, 2018 04:43
SENDING OUT AN EMAIL WHEN A POST IS PUBLISHED
<?php
function post_published_notification( $ID, $post ) {
$author = $post->post_author; /* Post author ID. */
$name = get_the_author_meta( 'display_name', $author );
$email = get_the_author_meta( 'user_email', $author );
$title = $post->post_title;
$permalink = get_permalink( $ID );
$edit = get_edit_post_link( $ID, '' );
$to[] = sprintf( '%s <%s>', $name, $email );
/*$to = 'youremail@gmail.com';*/
@dasbairagya
dasbairagya / index.html
Created December 15, 2017 12:35
Distancce calculator between two place
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css">
body
{
font-family: Arial;
font-size: 10pt;
}
@dasbairagya
dasbairagya / archive.php
Created December 15, 2017 12:08
Common category page to view category and subcategory according to menu organize.
<?php get_header(); ?>
<div id="banner-area" class="banner-area" style="background-image:url(<?php echo get_template_directory_uri(); ?>/images/banner/banner2.jpg)">
<!-- Subpage title start -->
<div class="banner-text text-center">
<div class="container">
<div class="row">
<div class="col-xs-12">
<div class="banner-heading">
<h1 class="page-title" style="color:#FFF; text-transform:uppercase;"><?php
@dasbairagya
dasbairagya / comments.php
Last active December 28, 2017 13:02
Custom word press comment template creation
<?php function my_comments_callback( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
?> <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
<div class="media comment-author">
<a class="media-left pull-left flip" href="#">
<!-- comment author image -->
<img class="img-thumbnail" src="images/blog/comment2.jpg" alt="">
<?php /*echo get_avatar( get_comment_author_email(), 32, $default_avatar );*/?>
</a>
@dasbairagya
dasbairagya / form.php
Created November 29, 2017 08:48
Upload Gallery Image and thumbnail image from front-end
<?php
/* Template Name: Free Form*/
get_header() ;
global $post;
global $wpdb;
require_once(ABSPATH . "wp-admin" . '/includes/image.php');
require_once(ABSPATH . "wp-admin" . '/includes/file.php');
@dasbairagya
dasbairagya / index.html
Created October 16, 2017 06:02
Google map auto address finder....
<!-- @section googlemapscripts -->
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<div class="col-sm-12">
<div class="form-group">
<input class="form-control" data-val="true" data-val-required="The Company Address field is required." id="Company_Address" name="Company_Address" placeholder="Enter Company Address*" required="true" type="text" value="" autocomplete="off">
@dasbairagya
dasbairagya / archive.php
Last active January 1, 2018 06:30
category page for custom post type(archive.php)
<?php
get_header();
global $post;
global $wpdb;
$term = get_queried_object();//get the current term
$taxonomy = $term->taxonomy;
$term_id = $term->term_id;//get the currnet term ID
$term_name = $term->name;//get the current term name
$parent_id = empty( $term_id ) ? 0 : $term_id;//get the parent id of the currnet term
$term_parent = get_term($term->parent);//get the parent term from the child term
@dasbairagya
dasbairagya / functions.php
Last active July 5, 2018 04:44
Woocommerce breadcrum links......................
<?php
/*********best practice to use <?php woocommerce_breadcrumb( ); ?> this function**********************/
/*****for custom structure use bellow code in your theme function.php and call <?php if(function_exists('get_hansel_and_gretel_breadcrumbs')):
echo get_hansel_and_gretel_breadcrumbs(); endif; ?> to get the out put**********************/
//https://www.thewebtaylor.com/articles/wordpress-creating-breadcrumbs-without-a-plugin
function get_hansel_and_gretel_breadcrumbs()
{
// Set variables for later use
$here_text = __( 'You are currently here!' );
@dasbairagya
dasbairagya / functions.php
Last active July 17, 2023 04:17
Add a WYSIWYG Field to WooCommerce Product Category Page
<?php
/********************************************Add a custom filed in the categoy*************************/
add_action( 'init', 'wpm_product_cat_register_meta' );
/**
* Register details product_cat meta.
*
* Register the details metabox for WooCommerce product categories.
*
*/
function wpm_product_cat_register_meta() {
@dasbairagya
dasbairagya / index.html
Created August 12, 2017 10:31
Multi language google translator script for website
<div style="margin-top: 20px;" id="google_translate_element"></div>
<script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({ pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE }, 'google_translate_element');
}
</script>
<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>