Skip to content

Instantly share code, notes, and snippets.

View ahmadawais's full-sized avatar
Building the LLM computing primitive at Langbase.com

Ahmad Awais ⌘ ahmadawais

Building the LLM computing primitive at Langbase.com
View GitHub Profile
@ahmadawais
ahmadawais / gist:0ddde36a2bb8c83bd52b
Created October 6, 2014 01:42
Check if it is a particular WordPress page
/**
* @Check if it is a particular WordPress page
* @Codex http://codex.wordpress.org/Function_Reference/is_page
*
*/
if(is_page(42)){
//This runs when page with ID 42 is being displayed
}
else{
@ahmadawais
ahmadawais / page-login.php
Last active July 20, 2019 09:18
WordPress Frontend Login Page [UPDATED]
<?php
/**
* Template Name: Login Page AA
*
* Login Page Template.
*
* @author Ahmad Awais
* @since 1.0.0
*/
@ahmadawais
ahmadawais / meta.php
Created October 19, 2014 10:06
Echo and Decode HTML in a Meta value of WordPress
<?php
/*
* Normally
* $content=get_post_meta($post->ID, 'SMTH_METANAME_VALUE', true);
* echo $content
**/
echo html_entity_decode($content);
// Custom Dashboard widgets
function custom_dashboard_widgets() {
global $wp_meta_boxes;
unset( $wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press'] );
unset( $wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links'] );
unset( $wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins'] );
unset( $wp_meta_boxes['dashboard']['side']['core']['dashboard_primary'] );
unset( $wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now'] );
unset( $wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments'] );
@ahmadawais
ahmadawais / functions.php
Last active August 29, 2015 14:08
WordPress Login Redirect
/** Login Redirect
* Redirect user after successful login.
*
* @param string $redirect_to URL to redirect to.
* @param string $request URL the user is coming from.
* @param object $user Logged user's data.
* @return string
*/
function my_login_redirect( $redirect_to, $request, $user ) {
//is there a user to check?
@ahmadawais
ahmadawais / functions.php
Created October 30, 2014 17:09
Custom Login/Logout handling for using WordPress as a CMS
/*Login Error Handle*/
add_action( 'wp_login_failed', 'aa_login_failed' ); // hook failed login
function aa_login_failed( $user ) {
// check what page the login attempt is coming from
$referrer = $_SERVER['HTTP_REFERER'];
// check that were not on the default login page
if ( !empty($referrer) && !strstr($referrer,'wp-login') && !strstr($referrer,'wp-admin') && $user!=null ) {
// make sure we don't already have a failed login attempt
@ahmadawais
ahmadawais / HTML-Table-&-CSS-Table.markdown
Created November 26, 2014 16:41
HTML Table & CSS Table

HTML Table & CSS Table

CSS Tables are cool. Use CSS Tables for layouts when you need easy vertical alignment, CSS based fixed footers with dynamic heights, and stack ordering.

A Pen by Ahmad Awais on CodePen.

License.

@ahmadawais
ahmadawais / Particles.js-based-Hero-Unit.markdown
Last active August 29, 2015 14:10
ParticlesJS based Hero Unit

Particles.js based Hero Unit

Using particle to build an animated hero unit for an upcoming product.

A Pen by Ahmad Awais on CodePen.

License.

@ahmadawais
ahmadawais / Basic-CSS-Hacks.markdown
Created November 28, 2014 11:16
Basic CSS Hacks