Shortcode to post custom category posts and count
-
Hello nice Framework!
I tried to built in new shortcode and i dont know, How do I list the names of the categories in select box on new shortcode?this code in my class file
<?php if (!defined('FW')) die('Forbidden'); class FW_Shortcode_Div extends FW_Shortcode { public static function my_thecat() { global $post; $result = array(); foreach((get_the_category($post->ID)) as $category) { $result[ $category['cat_name'] ] = $category['name']; } return $result; } }and this in my options file
<?php if (!defined(‘FW’)) die(‘Forbidden’);
$options = array(
‘id’ => array(
‘label’ => __(‘Catname’, ‘{domain}’),
‘desc’ => __(‘The button label’, ‘{domain}’),
‘type’ => ‘select’,
‘choices’ => FW_Shortcode_Div::my_thecat())
after that in builder shortcode dont show the list of categories in select box/
please help
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘Shortcode to post custom category posts and count’ is closed to new replies.