Skip to content

Instantly share code, notes, and snippets.

View asharirfan's full-sized avatar

Ashar Irfan asharirfan

View GitHub Profile
@asharirfan
asharirfan / tmr-settings.php
Last active November 24, 2017 13:35
WPC — Settings for Tell My Role plugin.
<?php
/**
* Settings Init.
*
* Initialize settings for the plugin.
*
* @since 1.0.0
*/
function tmr_settings_init() {
// Register a new setting for `general` page.
<?php
/**
* Style the Display.
*
* This method styles the user roles.
*
* @since 1.0.0
*/
function tmr_style_display() {
?>
@asharirfan
asharirfan / wpc-print-user-roles.php
Last active November 15, 2017 15:32
WPC — Print current user roles in WP admin dashboard 💯
<?php
/**
* Tell My Role.
*
* Get the roles of current user and display it.
*
* @since 1.0.0
*/
function tmr_display_current_user_role() {
// Get current user.
@asharirfan
asharirfan / wpc-tell-my-role-file-headers.php
Last active November 13, 2017 15:07
WPC — Tell My Role plugin headers.
<?php
/**
* Plugin Name: Tell My Role
* Plugin URI: https://WPCouple.com
* Description: A plugin to display user roles in WordPress dashboard.
* Version: 1.0.0
* Author: WPCouple
* Author URI: https://WPCouple.com
* Contributors: WPCouple, mrasharirfan
* License: GPL-2.0+
@asharirfan
asharirfan / wpc-functions.php
Created November 9, 2017 15:36
WPC — Add site title to every post title.
<?php
/**
* Add Site Title.
*
* Add site title to every post title.
*
* @param string $title - Title of the post.
*/
function wpc_add_sitename_to_title( $title ) {
// Get the site title.
@asharirfan
asharirfan / wpc-hello-world.php
Last active November 7, 2017 19:10
WPC — Hello World Plugin Function
<?php
/**
* Hello World.
*
* Display Hello World in WP Admin.
*
* @since 1.0.0
*/
function wpc_hello_world() {
echo '<p>Hello World</p>';
@asharirfan
asharirfan / wpc-hello-world-plugin-headers.php
Last active November 7, 2017 19:14
WPC — Hello World Plugin File Headers
<?php
/**
* Plugin Name: Hello World
* Plugin URI: https://WPCouple.com
* Description: A basic WordPress Plugin.
* Version: 1.0.0
* Author: WPCouple
* Author URI: https://WPCouple.com
* Contributors: WPCouple
* License: GPL-2.0+
require('babel-register')
const webpack = require('webpack')
const path = require('path')
const I18nPlugin = require("i18n-webpack-plugin")
const merge = require('webpack-merge')
const validate = require('webpack-validator')
const pkg = require('./package.json')
const toHtml = require('vdom-to-html')
const app = require('./app/views/app').default
const parts = require('./webpack.config.parts')
@asharirfan
asharirfan / my-plugin.php
Created October 3, 2017 19:10
Basic WordPress Plugin file headers
<?php
/**
* Plugin Name: My Plugin
* Plugin URI: https://my-plugin.com
* Description: A basic WordPress Plugin.
* Version: 1.0.0
* Author: Ashar Irfan
* Author URI: https://asharirfan.com
* Contributors: mrasharirfan
* License: GPL-2.0+
@asharirfan
asharirfan / custom-permalink-from-meta.php
Created September 6, 2017 11:52 — forked from petenelson/custom-permalink-from-meta.php
WordPress permalink for custom post type based on post meta