Skip to content

Instantly share code, notes, and snippets.

View yasircs4's full-sized avatar
🎯
Focusing

Yasir Najeeb yasircs4

🎯
Focusing
View GitHub Profile
@yasircs4
yasircs4 / datetime-tag-HTML5-Wordpress.txt
Last active July 22, 2016 23:13
Wordpress HTML5 time tag
<time datetime="<?php the_date('Y-m-d');?>"><?php the_time('F j, Y');?></time>
// Output
<time datetime="2012-06-10">June 10, 2012</time>
function activate_maintenance_mode() {
if ( !(current_user_can( 'administrator' ) || current_user_can( 'super admin' ))) {
wp_die('<h1> Sorry Site Closed </h1>
<p>Hello،
Site Under maintenance.
https://developers.facebook.com/tools/debug/sharing/
/**
* Override Jetpack's default OpenGraph image.
* Standard is blank WordPress image (https://s0.wp.com/i/blank.jpg).
* Christoph Nahr 2015-07-07
*/
@yasircs4
yasircs4 / functions.php
Created October 2, 2016 23:43
Enqueue Dashicons with the Genesis Framework.
<?php
//* Do NOT include the opening php tag
//* Enqueue Dashicons
add_action( 'wp_enqueue_scripts', 'enqueue_dashicons' );
function enqueue_dashicons() {
wp_enqueue_style( 'dashicons' );
}
https://developer.wordpress.org/reference/functions/get_post/
$post_info = get_post( 10 );
$author = $post_info->post_author;
https://jetpack.com/support/development-mode/
http://wordpress.stackexchange.com/questions/189532/how-to-run-jetpack-from-localhost
Add this to your wp-config.php:
const JETPACK_DEV_DEBUG = TRUE;
https://jetpack.com/support/subscriptions/
Ex:
<?php echo do_shortcode('[jetpack_subscription_form]'); ?>
@yasircs4
yasircs4 / gist:47a33dc052a007d1922720f4a1b31a44
Created October 31, 2016 09:52 — forked from prime31/gist:5675017
Simple PHP script showing how to send an Android push notification. Be sure to replace the API_ACCESS_KEY with a proper one from the Google API's Console page. To use the script, just call scriptName.php?id=THE_DEVICE_REGISTRATION_ID
<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array
@yasircs4
yasircs4 / more-posts -wordpress
Last active November 9, 2016 20:12
المزيد من المنشورات
@yasircs4
yasircs4 / wordpress-firebase.php
Created November 25, 2016 05:49 — forked from derekconjar/wordpress-firebase.php
An example of using Firebase and WordPress together. The idea is to use WP's custom post types and metaboxes to make content management easy, and sync with Firebase so that your websites have access to a real-time JSON feed of your custom data.
<?php
/**
* All custom functions should be defined in this class
* and tied to WP hooks/filters w/in the constructor method
*/
class Custom_Functions {
// Custom metaboxes and fields configuration