Skip to content

Instantly share code, notes, and snippets.

@Galibri
Created October 14, 2017 16:04
Show Gist options
  • Save Galibri/33ef5e8dee4ecd1f0e17104e62576b75 to your computer and use it in GitHub Desktop.
Save Galibri/33ef5e8dee4ecd1f0e17104e62576b75 to your computer and use it in GitHub Desktop.
<?php
/*
Plugin Name:Stock Toolkit
*/
function stock_alert_shortcode($atts, $content=null){
extract(shortcode_atts(
array(
'city' => '',
), $atts ));
if( $city == 'Dhaka' ){
$message = '' . esc_html( $city ) . ' is the most wonderfull city';
}elseif( $city == 'sylhet' ){
$message = '' . esc_html( $city ) . ' is the most wonderfull city';
}elseif( $city == 'mymensingh' ){
$message = '' . esc_html( $city ) . ' is the most wonderfull city';
}else{
$message= '' . esc_html( $city ) . ' we do not know';
}
return $message;
}
add_shortcode( 'alert','stock_alert_shortcode' );
function stock_shortcode($atts, $content=null){
extract(shortcode_atts(
array(
'id' => '',
), $atts));
$imag_array = wp_get_attachment_image_src( $id,'large' );
return $imag_array;
}
add_shortcode( 'image','stock_shortcode' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment