Exemplo n.º 1
0
 function warrior_vc_post_tabs_set_param()
 {
     $categories_array = array();
     $categories_obj = get_categories('type=post&hierarchical=true&orderby=name&hide_empty=0');
     $categories_array = warrior_array_cat_list_id(0, $categories_obj, $categories_array, 0);
     vc_map(array("name" => esc_html__("Post Tabs", "newmagz"), "base" => "warrior_vc_post_tabs", "description" => esc_html__("Display post list tabs on homepage.", "newmagz"), "category" => esc_html__("Warrior Widgets", "newmagz"), "icon" => get_template_directory_uri() . "/images/warrior-icon.png", "content_element" => true, "is_container" => true, "params" => array(array("type" => "textfield", "heading" => esc_html__("Title", "newmagz"), "value" => esc_html__("Post Tabs", "newmagz"), "param_name" => "post_tabs_title"), array("type" => "dropdown", "heading" => esc_html__("Categories 1", "newmagz"), "param_name" => "post_tabs_categories_1", "value" => $categories_array, "description" => esc_html__("Select Categories.", "newmagz")), array("type" => "dropdown", "heading" => esc_html__("Categories 2", "newmagz"), "param_name" => "post_tabs_categories_2", "value" => $categories_array, "description" => esc_html__("Select Categories.", "newmagz")), array("type" => "dropdown", "heading" => esc_html__("Categories 3", "newmagz"), "param_name" => "post_tabs_categories_3", "value" => $categories_array, "description" => esc_html__("Select Categories.", "newmagz")), array('type' => 'textfield', 'heading' => esc_html__('Post Title Limiter', 'newmagz'), 'param_name' => 'post_tabs_title_limiter', 'value' => 12), array('type' => 'textfield', 'heading' => esc_html__('Post Content Limiter', 'newmagz'), 'param_name' => 'post_tabs_content_limiter', 'value' => 35), array('type' => 'dropdown', 'heading' => esc_html__('CSS Animation', 'newmagz'), 'param_name' => 'css_animation', 'admin_label' => true, 'value' => array(esc_html__('No', 'newmagz') => '', esc_html__('Flash', 'newmagz') => 'flash', esc_html__('Pulse', 'newmagz') => 'pulse', esc_html__('FadeIn', 'newmagz') => 'fadeIn', esc_html__('ZoomIn', 'newmagz') => "zoomIn"), 'description' => esc_html__('Select type of animation for element to be animated when it "enters" the browsers viewport (Note: works only in modern browsers).', 'newmagz')), array('type' => 'textfield', 'heading' => esc_html__('Extra class name', 'newmagz'), 'param_name' => 'el_class', 'description' => esc_html__('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'newmagz')), array('type' => 'css_editor', 'heading' => esc_html__('CSS', 'newmagz'), 'param_name' => 'css', 'group' => esc_html__('Design options', 'newmagz')))));
 }
Exemplo n.º 2
0
 function warrior_array_cat_list_id($parent, $obj, $arr, $lvl)
 {
     $lvl++;
     foreach ($obj as $cat) {
         if ($cat->parent == $parent) {
             $arr[$cat->cat_ID] = str_pad('', $lvl - 1, '-') . ' ' . $cat->cat_name;
             $arr = warrior_array_cat_list_id($cat->cat_ID, $obj, $arr, $lvl);
         }
     }
     return $arr;
 }
    function form($instance)
    {
        $instance = wp_parse_args((array) $instance, array('warrior_recent_post_by_category_title' => esc_html__('Recent Posts', 'newmagz'), 'warrior_recent_post_by_category_category' => '', 'warrior_recent_post_by_category_title_count' => '8', 'warrior_recent_post_by_category_count' => '6'));
        //Access the WordPress Categories via an Array
        $categories_array = array();
        $categories_obj = get_categories('type=post&hierarchical=true&orderby=name&hide_empty=0');
        $categories_array = warrior_array_cat_list_id(0, $categories_obj, $categories_array, 0);
        ?>

		<p>
			<label for="<?php 
        echo $this->get_field_id('warrior_recent_post_by_category_title');
        ?>
"><?php 
        esc_html_e('Widget Title:', 'newmagz');
        ?>
</label>
			<input type="text" id="<?php 
        echo $this->get_field_id('warrior_recent_post_by_category_title');
        ?>
" class="widefat" name="<?php 
        echo $this->get_field_name('warrior_recent_post_by_category_title');
        ?>
" value="<?php 
        echo esc_attr($instance['warrior_recent_post_by_category_title']);
        ?>
" />
		</p>
		<p>
			<label for="<?php 
        echo $this->get_field_id('warrior_recent_post_by_category_category');
        ?>
"><?php 
        esc_html_e('Category:', 'newmagz');
        ?>
</label>
			<select id="<?php 
        echo $this->get_field_id('warrior_recent_post_by_category_category');
        ?>
" name="<?php 
        echo $this->get_field_name('warrior_recent_post_by_category_category');
        ?>
" class="widefat">
			<?php 
        foreach ($categories_array as $id => $category) {
            ?>
				<option value="<?php 
            echo $id;
            ?>
" <?php 
            echo selected($instance['warrior_recent_post_by_category_category'], $id, false);
            ?>
><?php 
            echo $category;
            ?>
</option>
			<?php 
        }
        ?>
			</select>
		</p>
        <p>
            <label for="<?php 
        echo $this->get_field_id('warrior_recent_post_by_category_title_count');
        ?>
"><?php 
        esc_html_e('Post Title Limiter', 'newmagz');
        ?>
</label>
            <input type="text" id="<?php 
        echo $this->get_field_id('warrior_recent_post_by_category_title_count');
        ?>
" class="widefat" name="<?php 
        echo $this->get_field_name('warrior_recent_post_by_category_title_count');
        ?>
" value="<?php 
        echo absint($instance['warrior_recent_post_by_category_title_count']);
        ?>
" />
            <p><small><?php 
        esc_html_e('The post title will be trim after reaching the number of characters defined, doesn\'t apply to first post.', 'newmagz');
        ?>
</small></p>
        </p>
        <p>
            <label for="<?php 
        echo $this->get_field_id('warrior_recent_post_by_category_count');
        ?>
"><?php 
        esc_html_e('Number of posts to show:', 'newmagz');
        ?>
</label>
            <input type="text" id="<?php 
        echo $this->get_field_id('warrior_recent_post_by_category_count');
        ?>
" class="widefat" name="<?php 
        echo $this->get_field_name('warrior_recent_post_by_category_count');
        ?>
" value="<?php 
        echo absint($instance['warrior_recent_post_by_category_count']);
        ?>
" />
        </p>
	<?php 
    }