Skip to content

Instantly share code, notes, and snippets.

INITIALISATION
==============
load wp-config.php
set up default constants
load wp-content/advanced-cache.php if it exists
load wp-content/db.php if it exists
connect to mysql, select db
load object cache (object-cache.php if it exists, or wp-include/cache.php if not)
load wp-content/sunrise.php if it exists (multisite only)
@mo3aser
mo3aser / Envato-replies-template-codes.js
Last active December 3, 2019 10:02
I use the follwing code on ThemeForest to add pre replies templates for the comments section, more info here https://mo3aser.com/?p=4129
/* Append the Custom Styles */
var css = '.banner{display:none !important}.comment__header{margin-bottom:1em!important}.comment__header small{clear:both!important;display:block!important}.comment__meta{padding-top:5px!important;}.headerstrip .is-hidden-tablet-and-below{padding:0!important;}.headerstrip__content--desktop{height:60px!important;padding-top:0!important;}.item-grid>li{width:139px!important;}.theme-label-Jannah{background:#00b8ff!important;}.theme-label-Jarida{background:#c70000!important;}.theme-label-Sahifa{background:orange!important;}.theme-label-name{float:right!important;font-size:16px!important;margin-left:10px!important;padding:8px 10px!important}.user-info-header__user-details{overflow:hidden!important}',
head = document.head || document.getElementsByTagName('head')[0],
style = document.createElement('style');
head.appendChild(style);
style.appendChild(document.createTextNode(css));
/* */
jQuery('.comment__initial').each(function() {
@mo3aser
mo3aser / functions.php
Created November 28, 2016 13:42 — forked from contempoinc/functions.php
Admin CSS to remove Slider Revolution & Visual Composer Notices
<?php
/*-----------------------------------------------------------------------------------*/
/* Admin CSS */
/*-----------------------------------------------------------------------------------*/
if(!function_exists('ct_admin_css')) {
function ct_admin_css() {
echo '<style>';
echo 'tr[data-slug="slider-revolution"] + .plugin-update-tr, .vc_license-activation-notice, .rs-update-notice-wrap, tr.plugin-update-tr.active#js_composer-update { display: none !important;}';
@mo3aser
mo3aser / fix-infinite-redirect.php
Last active June 16, 2020 18:39
infinite redirect on static front page WordPress
<?php
/**
* Plugin Name: Fix infinite redirect on static front page
* Description: Use this simple plugin to Fix infinite redirect on static front page with some WordPress versions
* Plugin URI: https://tielabs.com/
* Author: TieLabs
* Author URI: https://tielabs.com
* Version: 0.1.0
* License: GPLv2 or later
*/
@mo3aser
mo3aser / google-fonts-php-array-2016.php
Created April 7, 2016 20:41
A php array of all Google web fonts April 2016
<?php
$google_fonts = array(
'ABeeZee',
'Abel',
'Abril+Fatface',
'Aclonica',
'Acme',
'Actor',
'Adamina',
@mo3aser
mo3aser / google-fonts-2016.json
Last active April 7, 2016 20:38
Json of all google web fonts April 2016
{
"kind": "webfonts#webfontList",
"items": [
{
"kind": "webfonts#webfont",
"family": "ABeeZee",
"category": "sans-serif",
"variants": [
"regular",
"italic"
<?php
add_action( 'wp_head', 'tie_add_mce_button');
add_action( 'wp_enqueue_scripts', 'tie_admin_register2' );
add_action( 'wp_enqueue_scripts', 'tie_shortcodes_mce_css' );
function tie_admin_register2(){
wp_register_script( 'tie-admin-main', get_template_directory_uri() . '/framework/admin/assets/js/tie.js', array( 'jquery' ) , false , false );
wp_register_style( 'tie-style', get_template_directory_uri().'/framework/admin/assets/style.css', array(), '', 'all' );
wp_enqueue_script( 'tie-admin-main' );
function tie_addWidgetToSidebar($sidebarSlug, $widgetSlug, $countMod, $widgetSettings = array()){
$sidebarOptions = get_option('sidebars_widgets');
if(!isset($sidebarOptions[$sidebarSlug])){
$sidebarOptions[$sidebarSlug] = array('_multiwidget' => 1);
}
$newWidget = get_option('widget_'.$widgetSlug);
if(!is_array($newWidget))$newWidget = array();
$count = count($newWidget)+1+$countMod;
$sidebarOptions[$sidebarSlug][] = $widgetSlug.'-'.$count;
@mo3aser
mo3aser / Removing the automatic <p> and <br> WordPress-Shortcodes.php
Last active December 18, 2015 13:18
Removing the automatic <p> and <br> WordPress Shortcodes.
<?php
// Removing the automatic <p> and <br> WordPress Shortcodes
// By Fouad Badawy | tielabs.com
function tie_fix_shortcodes($content){
$array = array (
'[raw]' => '',
'[/raw]' => '',
'<p>[raw]' => '',
'[/raw]</p>' => '',
@mo3aser
mo3aser / Fix-Chinese-Language-Excerpts-Issue.php
Last active October 29, 2015 09:01
Sahifa Theme - How To Fix Chinese Language Excerpts Issue
<?php
# 1- Edit framework/functions/theme-functions.php and find:
function tie_excerpt(){
add_filter( 'excerpt_length', 'tie_excerpt_global_length', 999 );
echo get_the_excerpt();
}
function tie_excerpt_home(){