Skip to content

Instantly share code, notes, and snippets.

@salmancreation
Created April 8, 2017 12:52
Show Gist options
  • Save salmancreation/a5ac556dff00b542f266c1e47f3afb7d to your computer and use it in GitHub Desktop.
Save salmancreation/a5ac556dff00b542f266c1e47f3afb7d to your computer and use it in GitHub Desktop.
Factorian WordPress Theme Development
<?php
if ( ! defined( 'ABSPATH' ) ) { exit; }
function factorian_service_box_shortcode($atts){
extract( shortcode_atts( array(
'service_image' => '',
'service_title' => '',
'service_desc' => '',
'service_link_page' => '',
'service_link_extranal' => '',
'service_link_text' => '',
'service_link_icon' => '',
), $atts) );
$factorian_service_box ='<div class="service_box_area">
<div class="single_service_item">';
$imageSrc = wp_get_attachment_image_src($service_image, 'large');
$factorian_service_box ='<div class="service-image">';
if( $imageSrc ) {
echo '<img src="' . $imageSrc[0] . '" />';
}
$factorian_service_box .='</div>';
$factorian_service_box .='<h3>'.$service_title.'</h3>
<p>'.$service_desc.'</p>';
$factorian_service_box .='<a href="#" class="btn_link">'.$service_link_text.' <i class="'.$service_link_icon.'"></i></a>';
$factorian_service_box .='</div></div>';
$factorian_service_box .='</div>';
return $factorian_service_box;
}
add_shortcode('factorian_service_box', 'factorian_service_box_shortcode');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment