Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- * PLugin Name: Factorian Toolkit
- */
- //function factorian_alert_shortcode($atts,$content=null){
- // return '<div class="alert alert-danger" role="alert">this is simple alert</div>
- // <div class="alert alert-success" role="alert">this is success alert</div>
- // <div class="alert alert-info" role="alert">this is info alert</div>
- // <div class="alert alert-warning" role="alert">this is warning alert</div>';
- // extract(shortcode_atts(
- // array(
- // 'city'=>''
- // ),
- // $stts
- // ));
- // if($city='Dhaka'){
- // $message=''.esc_html($city).' is the land of Dreams';
- // } elseif ($city='Sylhet') {
- // $message=''.esc_html($city).' is the land of green tea';
- // }elseif ($city='Borisal') {
- // $message=''.esc_html($city).' is the land of river';
- // }else{
- // $message='You are not define yet';
- // }
- // return $message;
- // extract(shortcode_atts(
- // array(
- // 'id'=>'',
- // 'size'=>''
- // ),
- // $atts
- // ));
- // $image_array=wp_get_attachment_image_src($id,$size);
- // return '<img src="'.$image_array[0].'"/>';
- // }
- // add_shortcode('image','factorian_alert_shortcode');
- // function post_list_shortcode($atts){
- // extract(shortcode_atts(
- // array(
- // 'count'=>-1,
- // 'type'=>'post'
- // ),
- // $atts
- // ));
- // $q=new WP_Query(
- // array(
- // 'posts_per_page'=>$count,
- // 'post_type'=>$type
- // ));
- // $list='<ul>';
- // while($q->have_posts()):$q->the_post();
- // $idd=get_the_ID();
- // $post_content=get_the_content();
- // $list .='<li><a href="'.get_permalink().'">'.get_the_title().'</a></li>';
- // endwhile;
- // $list.='</ul>';
- // wp_reset_query();
- // return $list;
- // }
- // add_shortcode('post_list','post_list_shortcode');
- add_action('init','factorian_theme_custom_post');
- function factorian_theme_custom_post(){
- register_post_type('testimonial',
- array(
- 'labels'=>array(
- 'name'=>__('Testimonials'),
- 'singular_name'=>__('Testimonial')
- ),
- 'support'=>array('title','editor','thumbnail','page-attributes'),
- 'public'=>false,
- 'show_ui'=>true,
- )
- );
- }
- function post_list_shortcode($atts){
- extract(shortcode_atts(array(
- 'count'=>-1,
- 'type'=>'post'
- ),
- $atts
- ));
- $q=new WP_Query(
- array(
- 'posts_per_page'=>$count,
- 'post_type'=>$type,
- 'color'=>'#dd4d4',
- 'icon'=>''
- )
- );
- $list='<ul>';
- while($q->have_posts()):$q->the_post();
- $idd=get_the_ID();
- $post_content=get_the_content();
- $list='<li><a style="color:'.$color.'"href="'.get_permalink().'">';
- if (!empty($icon)) {
- $list.='<i class="'.$icon.'"></i>';
- }
- $list.=''.get_the_title().'</a></li>';
- endwhile;
- $list.='</ul>';
- wp_reset_query();
- return $list;
- }
- add_shortcode('post_list','post_list_shortcode');
- function factorian_vc_postlist_addon(){
- vc_map(array(
- "name"=>__("Post list","my-text-domain"),
- "base"=>"post_list",
- "category"=>__("Factorian","my-text-domain"),
- "params"=>array(
- array(
- "type"=>"textfield",
- "heading"=>__("Post type","my-text-domain"),
- "param_name"=>"type",
- "value"=>__("post","my-text-domain"),
- "description"=>__("Type post type here.","my-text-domain")
- ),
- array(
- "type"=>"textfield",
- "heading"=>__("Post type","my-text-domain"),
- "param_name"=>"count",
- "value"=>__("-1","my-text-domain"),
- "description"=>__("Type how many item you want to show. type -1 for unlimited item","my-text-domain")
- ),
- array(
- "type"=>"colorpicker",
- "heading"=>__("Link color","my-text-domain"),
- "param_name"=>"color",
- "value"=>__("#dd4d4","my-text-domain"),
- "description"=>__("Select link color.","my-text-domain")
- ),
- array(
- "type"=>"iconpicker",
- "heading"=>__("Icon","my-text-domain"),
- "param_name"=>"icon",
- "value"=>__("fa fa-link","my-text-domain"),
- "description"=>__("Select link icon.","my-text-domain")
- )
- )
- ));
- }
- add_action('vc_before_init','factorian_vc_postlist_addon');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement