Skip to content

Instantly share code, notes, and snippets.

View fahidjavid's full-sized avatar
🎯
Focusing

Fahid Javid fahidjavid

🎯
Focusing
View GitHub Profile
@fahidjavid
fahidjavid / clearfix.css
Created August 25, 2017 15:31
ClearFix styles for container of floating divs
.clearfix { *zoom: 1; }
.clearfix:before, .clearfix:after { display: table; content: ""; line-height: 0; }
.clearfix:after { clear: both; }
@fahidjavid
fahidjavid / functions.php
Last active May 29, 2019 20:37
Real Homes: Add property custom meta fields
<?php
/**
* Add property custom meta fields
*/
function add_property_custom_fields( $new_fields ) {
$new_fields['tab'] = array(
'label' => 'Custom Tab', // tab name
'icon' => 'dashicons-admin-generic' // tab icon class (of dashicon). See all dashicons here: https://developer.wordpress.org/resource/dashicons
);
@fahidjavid
fahidjavid / javascript-dev-tools.js
Created June 15, 2017 13:04
Javascript debugging and development tools to help in javascript apps development.
// General
Console.log('Hey! This is Fahid.');
@fahidjavid
fahidjavid / useful-wordpress-constants.php
Last active June 15, 2017 13:02
A list of useful WordPress constants that can be used in themes and plugins day to day development.
<?php
##### General #####
define('WP_POST_REVISIONS', 3); // Values: true|false|number (Default: true)
/* (De)activates the revision function for posts. A number greater than 0 defines the number of revisions for one post. */
@fahidjavid
fahidjavid / pingback.php
Created June 14, 2017 09:07
Add a pingback url auto-discovery header for singularly identifiable articles.
<?php
if ( ! function_exists( 'prefix_pingback_header' ) ) {
/**
* Add a pingback url auto-discovery header for singularly identifiable articles.
*/
function prefix_pingback_header() {
if ( is_singular() && pings_open() ) {
printf( '<link rel="pingback" href="%s">' . "\n", get_bloginfo( 'pingback_url' ) );
}
@fahidjavid
fahidjavid / theme-readme-file.txt
Created June 12, 2017 11:00
A readme.txt file to put into the parent theme.
This theme comes with a detailed documentation that can be found in the theme package.
You can setup this theme same like demos site by following that documentation.
--------
For general WordPress issues you can search your issue in Google. As there are thousands of helping articles and forum threads out there to help WordPress users.
--------
@fahidjavid
fahidjavid / translate-with-html-tags.php
Last active June 11, 2017 16:24
Translate with HTML tags using esc_html_* function inside. Example: copyright text
<?php
// example one
htmlspecialchars_decode( esc_html__( 'You have to setup the permalinks settings to
<strong>Post name</strong> from <code>Settings > Permalinks</code> page.', 'text-domain' ) );
// second example using whitelist (starred repo) function
whitelist_html( sprintf( __( "&copy; Copyright %s <a href='%s'>%s</a> - All Right Reserved.", 'text-domain' ), date( 'Y' ), get_site_url(), get_bloginfo( 'name' ) ), wp_kses_allowed_html() )
@fahidjavid
fahidjavid / is-woocommerce-activated.php
Created June 1, 2017 05:19
Check whether WooCommerce plugin is activated or not
<?php
if ( ! function_exists( 'is_woocommerce_activated' ) ) {
/**
* Check whether WooCommerce plugin is activated or not
* @return bool
*/
function is_woocommerce_activated() {
if ( class_exists( 'WooCommerce' ) ) {
return true;
@fahidjavid
fahidjavid / setup-after-ocdi.php
Created May 30, 2017 08:06
Set up the blog and front page plus menu locations after 'One Click Demo Import'
<?php
if ( ! function_exists( 'prefix_after_import' ) ) {
/**
* Set up the news and front page plus menu locations
* @param $selected_import
*/
function prefix_after_import( $selected_import ) {
if ( 'Demo Import' === $selected_import['import_file_name'] ) {
@fahidjavid
fahidjavid / page.html
Created May 21, 2017 13:16
Sticky Footer
<div class="page-wrap">
Content!
</div>
<footer class="site-footer">
I'm the Sticky Footer.
</footer>