Skip to content

Instantly share code, notes, and snippets.

View amitabhaghosh197's full-sized avatar

amitabha ghosh amitabhaghosh197

View GitHub Profile
@amitabhaghosh197
amitabhaghosh197 / perfect_way_to_include_cdn_in_wordpress.php
Last active September 9, 2017 18:59
Perfect way to include cdns in Wordpress #wordpress
<?php
global $wp_filesystem;
if(!empty($wp_filesystem)){
$cdn_urls = __('https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.1.0/animate.min.css',r);
$cdn_urls = __('http://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css', r);
}
if( $cdn_urls !== false)
@amitabhaghosh197
amitabhaghosh197 / Custom-menu-sidebar-widget.php
Created June 30, 2014 18:49
Custom-menu-sidebar-widget
<?php
add_action("widgets_init", "stepup_custom_widgets");
function stepup_custom_widgets() {
unregister_widget("WP_Nav_Menu_Widget");
register_widget("stepup_Nav_Menu_Widget");
@amitabhaghosh197
amitabhaghosh197 / underscore_template-tags.
Last active August 29, 2015 14:03
Underscore template-tags.php
<?php
// Refference 1. Codex: get_the_category http://codex.wordpress.org/Function_Reference/get_the_category
//Reff 2 : get_the_category only displays 'Array'---> http://wordpress.org/support/topic/get_the_category-only-displays-array
// Reff 3 : Codex Function Reference/get category link ---> http://codex.wordpress.org/Function_Reference/get_category_link
?>
<?php
/**
@amitabhaghosh197
amitabhaghosh197 / jquery-function.php
Created July 2, 2014 13:24
jquery functtion.php
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script>window.jQuery || document.write("<script src='<?php echo get_template_directory_uri(); ?>/js/libs/jquery-1.6.1.min.js'>\x3C/script>")</script>
<?php
/**
* The template for displaying all pages.
*
* This is the template that displays all pages by default.
* Please note that this is the WordPress construct of pages
* and that other 'pages' on your WordPress site will use a
* different template.
*
* @package stepup
@amitabhaghosh197
amitabhaghosh197 / star-rating-for-products.css
Last active April 13, 2022 12:29
Add Star Rating to individual Products in Woocommerce #woocommerce #wordpress
/** Source http://www.pootlepress.com/2014/04/100-woocommerce-tips-tricks/
Change the Woocommerce star ratings to show stars rather than theme ratings
**/
.star-rating{float:right;width:80px;height:16px;background:url(images/star.png) repeat-x left 0}
.star-rating span{background:url(images/star.png) repeat-x left -32px;height:0;padding-top:16px;overflow:hidden;float:left}
.hreview-aggregate .star-rating{margin:10px 0 0 0}
#review_form #respond{position:static;margin:0;width:auto;padding:0 0 0;background:transparent none;border:0}
@amitabhaghosh197
amitabhaghosh197 / bootstrap2.3.2.js
Last active August 29, 2015 14:03
bootstrap 2.3.2 make dropdown menu open when clicked
// Source bootstrap.js
//Inspiration http://stackoverflow.com/questions/19740121/keep-bootstrap-dropdown-open-when-clicked-off
// Though the Inspiration is about bootstrap 3.0
// It is often found that the dropdown-menu gets off when clicked inside.
// So it is the code to make the dropdown menu open when clicked inside.
// basically in bootstrap.js in the line 765 to 770 it is written
//$(document)
// .on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus)
//.on('click.dropdown touchstart.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
<div class=" modal hide fade" id="myModal" >
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
</div>
<div class="modal-body">
<?php
$args = array(
@amitabhaghosh197
amitabhaghosh197 / Details
Last active August 29, 2015 14:04
Text Styling in <li> elements , specially in 2nd line of text when <li> has a list style icon
Sometimes while writing text in <li> elements in 2 line when <li> element has an icon before, it is seen that the 1st text line keeps the distance from the icon properly but the 2nd line starts from beneath the icon. So to clear all these and make it a fresh one follow the following files.
Only the thing:
1. ul style : display: table;
2. ul li style: display: table-row;
3. ul li:before : display: table-cell;
4. Add li:after style to have the proper margin from one li to another li