/**
  * Add special Simmer classes to <body>.
  *
  * @since 1.2.0
  * @see body_class()
  *
  * @param  array $classes The existing body classes as generated by WordPress.
  * @return array $classes The newly generated body classes.
  */
 public function add_body_classes($classes)
 {
     $object_type = simmer_get_object_type();
     if (is_singular($object_type) || is_post_type_archive($object_type) || is_tax(simmer_get_category_taxonomy())) {
         $classes[] = 'simmer';
     }
     /**
      * Filter the Simmer body classes.
      *
      * @since 1.2.0
      *
      * @param array  $classes   The generated body classes.
      */
     $classes = apply_filters('simmer_body_classes', $classes);
     return $classes;
 }
 /**
  * Display the widget on the front end.
  *
  * @since 1.1.0
  *
  * @param array $args     The sidebar args for the instance.
  * @param array $instance The instance and its settings.
  */
 public function widget($args, $instance)
 {
     if (!isset($args['widget_id'])) {
         $widget_id = $this->id;
     } else {
         $widget_id = $args['widget_id'];
     }
     $sidebar_id = $args['id'];
     // Output the wrapper.
     echo $args['before_widget'];
     /**
      * Filter the settings for the instance.
      *
      * @since 1.1.0
      *
      * @param array  $instance   The instance's settings.
      * @param string $widget_id  The instance's ID.
      * @param string $sidebar_id The ID of the sidebar in which the instance is located.
      */
     $instance = apply_filters('simmer_categories_widget_settings', $instance, $widget_id, $sidebar_id);
     /**
      * Filter the title for the instance.
      *
      * @since 1.1.0
      *
      * @param string $title      The instance's title.
      * @param string $widget_id  The instance's ID.
      * @param string $sidebar_id The ID of the sidebar in which the instance is located.
      */
     $title = apply_filters('simmer_categories_widget_title', $instance['title'], $widget_id, $sidebar_id);
     if ($title) {
         echo $args['before_title'] . $title . $args['after_title'];
     }
     // Define the wp_list_categories args based on this widget instance's settings.
     $list_args = array('show_count' => $instance['show_count'], 'hierarchical' => $instance['hierarchical'], 'title_li' => false);
     /**
      * Filter the wp_list_categories args for the widget.
      *
      * @since 1.1.0
      *
      * @param array  $list_args  The arguments.
      * @param string $widget_id  The instance's ID.
      * @param string $sidebar_id The ID of the sidebar in which the instance is located.
      */
     $list_args = apply_filters('simmer_categories_widget_list_args', $list_args, $widget_id, $sidebar_id);
     // Override the above filter to always set the taxonomy to display recipe categories.
     $list_args['taxonomy'] = simmer_get_category_taxonomy();
     /**
      * Execute before displaying the widget.
      *
      * @since 1.1.0
      *
      * @param string $widget_id  The instance's ID.
      * @param string $sidebar_id The ID of the sidebar in which the instance is located.
      */
     do_action('simmer_before_categories_widget', $widget_id, $sidebar_id);
     // Output the main markup.
     include plugin_dir_path(__FILE__) . 'html/categories-widget.php';
     /**
      * Execute after displaying the widget.
      *
      * @since 1.1.0
      *
      * @param string $widget_id  The instance's ID.
      * @param string $sidebar_id The ID of the sidebar in which the instance is located.
      */
     do_action('simmer_after_categories_widget', $widget_id, $sidebar_id);
     // Close the wrapper.
     echo $args['after_widget'];
 }
Example #3
0
					<strong><?php 
    _e('Yield', 'simmer');
    ?>
:</strong>
					<span itemprop="recipeYield"><?php 
    echo esc_html($yield);
    ?>
</span>
				</li>

			<?php 
}
?>

			<?php 
if ($categories = get_the_term_list(get_the_ID(), simmer_get_category_taxonomy(), '', ', ')) {
    ?>

				<li>
					<strong><?php 
    _e('Category', 'simmer');
    ?>
:</strong>
					<span itemprop="recipeCategory"><?php 
    echo $categories;
    ?>
</span>
				</li>

			<?php 
}
Example #4
0
 /**
  * Register the category taxonomy.
  *
  * @since 1.0.0
  */
 public function register_category_taxonomy()
 {
     $args = array('show_tagcloud' => false, 'show_admin_column' => true, 'hierarchical' => true, 'rewrite' => array('slug' => trailingslashit(simmer_get_archive_base()) . get_option('simmer_category_base', 'category'), 'with_front' => false));
     /**
      * Filter the taxonomy args.
      *
      * @since 1.0.0
      * @see register_taxonomy() for the available args.
      *
      * @param array $args {
      * 		The arguments that define the taxonomy's
      * 		labels and functionality.
      * }
      */
     $args = apply_filters('simmer_register_category_args', $args);
     // Finally register the taxonomy.
     register_taxonomy(simmer_get_category_taxonomy(), simmer_get_object_type(), $args);
     /*
      * Better safe than sorry.
      *
      * @link http://codex.wordpress.org/Function_Reference/register_taxonomy#Usage
      */
     register_taxonomy_for_object_type(simmer_get_category_taxonomy(), simmer_get_object_type());
 }