Last active
August 29, 2015 14:17
-
-
Save LinzardMac/96413ae5433a69ca0d84 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Custom Slider | |
function theme_kmca_teaser_slider($atts, $content) | |
{ | |
extract(shortcode_atts(array( | |
"class" => "", | |
"color" => "", | |
"type" => "", | |
"title" => "", | |
"subtitle" => "", | |
"categoryfilter" => "", | |
"top_margin" => "page_margin_top_none" | |
), $atts)); | |
echo '<pre>'; | |
echo 'categoryfilter'; | |
var_dump($categoryfilter); | |
echo '</pre>'; | |
$args = array( | |
'post_type' => 'classes', | |
'post_status' => 'publish', | |
'category_name' => $categoryfilter | |
); | |
$posts_array = new WP_Query( $args ); | |
/* echo '<pre>'; | |
// echo 'categoryfilter'; | |
var_dump($args); | |
echo '</pre>'; | |
$posts_array = new WP_Query( $args ); | |
echo '<pre>'; | |
var_dump($posts_array); | |
echo '</pre>';*/ | |
if($posts_array->have_posts()) | |
{ | |
while ( $posts_array->have_posts() ) { | |
$posts_array->the_post(); | |
echo '<div>' . get_the_title() . '</div>'; | |
} | |
} | |
// return $output | |
} | |
add_shortcode("kmca_teaser_slider", "theme_kmca_teaser_slider"); | |
// add_shortcode("KMCA Teaser Slider", "kmca_teaser_slider"); | |
//visual composer | |
wpb_map( array( | |
"name" => __("KMCA Teaser Slider", 'kmcabase'), | |
"base" => "kmca_teaser_slider", | |
"class" => "", | |
"controls" => "full", | |
"show_settings_on_create" => true, | |
"icon" => "icon-wpb-layer-items-list", | |
"category" => __('KmcaBase', 'kmcabase'), | |
"params" => array( | |
array( | |
"type" => "textfield", | |
"class" => "", | |
"heading" => __("Extra class name", 'kmcabase'), | |
"param_name" => "class", | |
"description" => __("Specifies the custom css class for the list.", 'kmcabase'), | |
"value" => "" | |
), | |
array( | |
"type"=> "textfield", | |
"class=" => "", | |
"heading" => __("Title", 'kmcabase'), | |
"param_name" => "title", | |
"value" => "" | |
), | |
array( | |
"type"=> "textfield", | |
"class=" => "", | |
"heading" => __("Subtitle", 'kmcabase'), | |
"param_name" => "subtitle", | |
"value" => "" | |
), | |
array( | |
"type" => "textfield", | |
"class" => "", | |
"heading" => __("Category Filter", 'kmcabase'), | |
"param_name" => "categoryfilter", | |
"description" => __("If you want to narrow output, enter category names here. Note: Only listed categories will be included. Divide categories with linebreaks (Enter) .", 'kmcabase'), | |
"value" => "" | |
), | |
) | |
)); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment