/** @see WP_Widget::widget */ function widget($args, $instance) { $items_page_id = get_option('dbaa_items_page'); if (get_the_ID() == $items_page_id && $items_page_id != 0) { $instance = array_merge($this->defaults, $instance); echo $args['before_widget']; echo $args['before_title']; echo $instance['title']; echo $args['after_title']; if (is_numeric($instance['time_limit']) && $instance['time_limit'] > 0) { $instance['scope'] = date('Y-m-d') . "," . date('Y-m-t', strtotime('+' . ($instance['time_limit'] - 1) . ' month')); } $instance['owner'] = false; $categories = aa_Categories::getCategoriesWithProducts(); echo "<ul>"; $li_wrap = !preg_match('/^<li>/i', trim($instance['format'])); if (count($categories) > 0) { foreach ($categories as $category) { if ($li_wrap) { echo '<li>' . aa_Categories::formatCategory($instance['format'], $category) . '</li>'; } else { echo aa_Categories::formatCategory($instance['format'], $category); } } } else { echo '<li>Keine Produkte in Kategorien vorhanden.</li>'; } if (!empty($instance['all_categories'])) { $categories_link = aa_getCategoriesLink($instance['all_categories_text']); echo '<li>' . $categories_link . '</li>'; } echo '</ul>'; echo $args['after_widget']; } }
function aa_items_page_title($content) { global $post, $item, $aa_category; $page_id = get_option('dbaa_items_page'); if ($post->ID == $page_id && $page_id != 0) { if (is_object($item) && !empty($item->item_title)) { // single event page $content = AA_Item::output_single($item->item_id, get_option('dbaa_item_page_title_tag_format')); } elseif (is_object($aa_category) && !empty($aa_category->category_englishname)) { $content = aa_Categories::formatCategory(get_option('dbaa_single_category_title_format'), $aa_category); } elseif (!empty($_REQUEST['item_categories'])) { $content = get_option('dbaa_categories_list_title'); } else { $content = get_option('dbaa_items_page_title'); } return $content . ' | '; } return $content; }