Skip to content

Instantly share code, notes, and snippets.

@iftee
iftee / wp-child-page-conditional.php
Last active June 14, 2016 10:04
WordPress: Function to check if current page is a direct child to another page
<?php
/*
* Check if the current pae is a direct child of another page.
* Accept's page ID, page slug or page title as parameters to identify the parent.
*/
/* Add the following code in the theme's functions.php */
function is_child( $parent = '' ) {
global $post;
@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
@iftee
iftee / keymap.cson
Created June 1, 2016 10:22
Fix for Emmet tab not working on Atom
# Your keymap
#
# Atom keymaps work similarly to style sheets. Just as style sheets use
# selectors to apply styles to elements, Atom keymaps use selectors to associate
# keystrokes with events in specific contexts. Unlike style sheets however,
# each selector can only be declared once.
#
# You can create a new keybinding in this file by typing "key" and then hitting
# tab.
#
@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;
@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%;
<?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) ) );
?>
<?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>
@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 / 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(){