Skip to content

Instantly share code, notes, and snippets.

@iftee
iftee / wp-remove-default-image-sizes.php
Last active November 12, 2022 00:21
Custom filter to remove default image sizes (WordPress and WooCommerce) from your theme.
<?php
/*
* Custom filter to remove default image sizes from WordPress.
*/
/* Add the following code in the theme's functions.php and disable any unset function as required */
function remove_default_image_sizes( $sizes ) {
/* Default WordPress */
unset( $sizes[ 'thumbnail' ]); // Remove Thumbnail (150 x 150 hard cropped)
@iftee
iftee / css-snippet-for-responsive-table-stylized.css
Last active August 4, 2021 11:14
A quick CSS for stylized responsive HTML table
/* CSS Snippet For Responsive Table - Stylized */
/* Basic */
* {
box-sizing: border-box;
}
table {
border-spacing: 0px;
<?php
/*
* Line break in WordPress meta box text area: the CSS way
*/
?>
<p class="whitespace">
<?php echo esc_html( get_post_meta( get_the_ID(), 'my-meta-field', true) ); ?>
</p>
<?php
/*
* Line break in WordPress meta box text area: the PHP way
*/
echo nl2br( esc_html( get_post_meta( get_the_ID(), 'my-meta-field', true) ) );
?>
@iftee
iftee / custom-page.php
Last active July 4, 2021 17:35
PrestaShop Custom Page without CMS - Custom Page File
<?php
/* Create a custom page in PrestaShop without CMS - Custom Page File
* Read the detailed tutorial at https://www.linkedin.com/pulse/prestashop-how-create-custom-page-without-cms-iftakhar-hasan/
*/
include(dirname(__FILE__).'/config/config.inc.php');
Tools::displayFileAsDeprecated();
include(dirname(__FILE__).'/header.php');
@iftee
iftee / CustomPageController.php
Last active July 4, 2021 17:34
PrestaShop Custom Page without CMS - CustomPageController Class
<?php
/* Create a custom page in PrestaShop without CMS - CustomPageController class
* Read the detailed tutorial at https://www.linkedin.com/pulse/prestashop-how-create-custom-page-without-cms-iftakhar-hasan/
*/
/* The classname here will be the name of the controller */
class CustomPageController extends FrontController{
public function init(){
@iftee
iftee / custom-page.tpl
Last active July 4, 2021 17:33
PrestaShop Custom Page without CMS - Custom Page Temaplate
{* Create a custom page in PrestaShop without CMS - Custom Page Temaplate *}
{* Read the detailed tutorial at https://www.linkedin.com/pulse/prestashop-how-create-custom-page-without-cms-iftakhar-hasan/ *}
<div>
<!-- Your HTML elements go here -->
</div>
{literal}
<style type="text/css">
/* Your CSS goes here */
@iftee
iftee / css-snippet-for-responsive-table-basic.css
Created December 27, 2015 09:56
A quick CSS for basic responsive HTML table
/* CSS Snippet For Responsive Table - Basic */
* {
box-sizing: border-box;
}
table {
border-spacing: 0px;
border-collapse: collapse;
width: 100%;
@iftee
iftee / page-autoscroll-jquery.js
Created October 25, 2020 13:58
A tiny jQuery snippet for auto page scroll during video capture of prototype
var scrollSpeed = 30000; // how fast the the page will be scrolled down to bottom in millisecond, change it based on your page height
var offsetTime = 10000; // an delay in in millisecond after which the page will start scrolling, change it based on your time to change window and go full-screen after you turn on recording
function scrollDownForVideoCapture() {
setTimeout(function() {
$('html, body').animate({ scrollTop: $(document).height() }, scrollSpeed)
}, offsetTime);
return false;
}
@iftee
iftee / wp-config-partial.php
Created June 1, 2016 12:52
Conditional DB Secting in wp-config.php for maintaining WordPress from Development Server and Pushing to Production Server
<?php
/*
* Unified variables
*/
$charset = 'UTF-8';
$collate = '';
/*
* Set variables conditianlly based on current environment