Skip to content

Instantly share code, notes, and snippets.

@saqibameen
saqibameen / wpc_get_logo.php
Last active November 8, 2017 17:04
WP: Plugin function that returns an image
<?php
/**
* Get Logo.
*
* Returns logo of WPCouple.com.
*
* @return mixed
*/
function wpc_get_logo() {
// Set source of image in img tag.
@saqibameen
saqibameen / wpc_shortcode_register.php
Last active November 9, 2017 16:34
WP: Function to register shortcode in WordPress
<?php
/**
* Register shortcode.
*
* Registers shortcode in WordPress.
*/
function wpc_register_shortcode() {
// Add shortcode.
add_shortcode( 'wpc-logo', 'wpc_get_logo' );
}
@saqibameen
saqibameen / hook_register_shortcode_function.php
Last active November 8, 2017 16:58
WP: Hook Function Using 'init' action
<?php
// Hook register shortcode function.
add_action( 'init', 'wpc_register_shortcode' );
@saqibameen
saqibameen / wpc_get_logo_with_size.php
Last active November 14, 2017 12:16
WP: Plugin function to return image in specified size (if any), default otherwise.
<?php
/**
* Get Logo.
*
* Returns logo of WPCouple.com in specified width (if any).
*
* @param array $atts Array of attributes.
* @return mixed
*/
function wpc_get_logo( $atts ) {
@saqibameen
saqibameen / wpc_get_logo_with_size_and_content.php
Last active November 9, 2017 16:39
WP: Main plugin function for a shortcode that takes argument and content from user.
<?php
/**
* Get Logo.
*
* Returns logo of WPCouple.com in specified width and content (if specified).
*
* @param array $atts Array of attributes.
* @param string $content String of content.
* @return mixed
*/
@saqibameen
saqibameen / install_zshell.sh
Created November 21, 2017 15:47
Install Z Shell Commands
sudo apt-get install zsh
@saqibameen
saqibameen / oh-my-zsh-install.sh
Created November 21, 2017 15:48
Install Oh My Zsh
curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh
@saqibameen
saqibameen / bash-tut.sh
Created November 21, 2017 15:51
Open .zshrc file
nano .zshrc
@saqibameen
saqibameen / zsh theme variable.sh
Created November 21, 2017 15:52
ZSH Theme Variable
ZSH_THEME="robbyrussell"
@saqibameen
saqibameen / zsh_random_theme.sh
Created November 21, 2017 15:54
Set ZSH Theme to Random
ZSH_THEME="random"