Skip to content

Instantly share code, notes, and snippets.

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

Niloy Niloys7

🏠
Working from home
View GitHub Profile
// Display Taxomonies
$terms = get_terms( 'fw-portfolio-category' ); // Taxomony Name
foreach ( $terms as $term ) {
// The $term is an object, so we don't need to specify the $taxonomy.
$term_link = get_term_link( $term );
// If there was an error, continue to the next term.
if ( is_wp_error( $term_link ) ) {
@Niloys7
Niloys7 / gist:17b88d36c1c38844a6cf2127c15dee63
Created February 24, 2017 01:17
Get Product Gallery Images - WooCommerce
<?php
global $product;
$attachment_ids = $product->get_gallery_attachment_ids();
foreach( $attachment_ids as $attachment_id )
{
//Get URL of Gallery Images - default wordpress image sizes
echo $Original_image_url = wp_get_attachment_url( $attachment_id );
echo $full_url = wp_get_attachment_image_src( $attachment_id, 'full' )[0];
echo $medium_url = wp_get_attachment_image_src( $attachment_id, 'medium' )[0];
@Niloys7
Niloys7 / TiggerOnScroll.js
Created November 15, 2015 03:33
Trigger action when a user scrolls past a certain part of the page
$(window).scroll(function() {
var y_scroll_pos = window.pageYOffset;
var scroll_pos_test = 500;
// set to whatever you want it to be
if(y_scroll_pos > scroll_pos_test) {
$("body").css("background-color","#000");
}
else
{
@Niloys7
Niloys7 / replace-wp_submit.php
Last active October 24, 2023 13:43 — forked from zutigrm/replace-wp_submit.php
Replace submitdiv in custom post type
<?php
/*=========================================
Custom Submit Box
==========================================*/
/**
* Loop throught custom post types and
* replace default submit box
*
* @since 1.0
*
@Niloys7
Niloys7 / equalWidth.js
Created October 25, 2015 06:46
Get Equal Width for element base on parent element
var total = 0;
$('.ClassName').each(function() {
total+= $(this).width();
total+= parseInt($(this).css('margin-left'), 0);
total+= parseInt($(this).css('margin-right'), 0);
total+= 0;
});
var num_blocks = $('.ClassName').size();