Skip to content

Instantly share code, notes, and snippets.

View accessomnath's full-sized avatar
🎯
Focusing

Somnath Mondal accessomnath

🎯
Focusing
View GitHub Profile
<body>
<div class="container">
<h2>Dynamic Tabs</h2>
<p>To make the tabs toggleable, add the data-toggle="tab" attribute to each link. Then add a .tab-pane class with a unique ID for every tab and wrap them inside a div element with class .tab-content.</p>
<ul class="nav nav-tabs" id="myLinks">
<li class="active"><a data-toggle="tab" href="#home">Home</a></li>
<li><a href="#menu1">Menu 1</a></li>
<li><a href="#menu2">Menu 2</a></li>
function tryMe (param1, param2) {
alert(param1 + " and " + param2);
}
function callbackTester (callback) {
callback (arguments[1], arguments[2]);
}
callbackTester (tryMe, "hello", "goodbye");
$config['base_url'] = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" : "http");
$config['base_url'] .= "://".$_SERVER['HTTP_HOST'];
$config['base_url'] .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
<script>
var picker = $('#test').pickadate({
format: 'dd/mm/yyyy'
}).pickadate('picker');
$('#previous_day, #next_day').click(function(e) {
e.preventDefault();
setDate($(this).data('diff'));
})
@accessomnath
accessomnath / multiacf.php
Last active March 22, 2019 04:40
ACF multi images like gallery upload front end
<div class="form-group mb-2 mt-3">
<label>Upload Their Images</label>
<br>
<input type="text" class="form-control">
<input type="file" name="uploads_images[]" class="files" size="50" multiple="multiple" />
<?php wp_nonce_field( 'uploads_images', 'my_image_upload_nonce' ); ?>
</div>
if ($_FILES) {
@accessomnath
accessomnath / add.php
Created March 18, 2019 16:10
Widget add
class widget_simple extends WP_Widget {
// Create Widget
function widget_simple() {
parent::WP_Widget(false, $name = 'Custom Simple Widget', array('description' => ''));
}
// Widget Content
function widget($args, $instance) {
extract( $args );
@accessomnath
accessomnath / unzip.php
Created February 24, 2019 12:07
Unzip file within the directory
<?php
$unzip = new ZipArchive;
$out = $unzip->open('wordpress.zip');
if ($out === TRUE) {
$unzip->extractTo(getcwd());
$unzip->close();
echo 'File unzipped';
} else {
echo 'Error';
}
@accessomnath
accessomnath / create_zip.php
Created February 24, 2019 12:06
Create a Zip with contents in the current Direcory
<?php
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> Create a Zip with contents in the current Direcory (php script)</title>
<style type="text/css">
body{
font-family: arial;
@accessomnath
accessomnath / Function.php
Last active July 14, 2019 00:31
to get the sale percentage
<?php
// Now you can have (3 possibilities):
// 1) The saving price:
add_filter( 'woocommerce_get_price_html', 'change_displayed_sale_price_html', 10, 2 );
function change_displayed_sale_price_html( $price, $product ) {
// Only on sale products on frontend and excluding min/max price on variable products
if( $product->is_on_sale() && ! is_admin() && ! $product->is_type('variable')){
// Get product prices
@accessomnath
accessomnath / gist:1817f526143921ca8c7b2efe056a7a87
Created October 17, 2018 18:01 — forked from mikejolley/gist:bcb1d47f50aea6f2c0d9
WP Job Manager - Make Job Location a required field
add_filter( 'submit_job_form_fields', 'make_location_field_required' );
function make_location_field_required( $fields ) {
$fields['job']['job_location']['required'] = true;
return $fields;
}