function check_data() { global $Refs; if (!is_date($_POST['date'])) { display_error(_("The entered date is invalid.")); set_focus('date'); return false; } if (!is_date_in_fiscalyear($_POST['date'])) { display_error(_("The entered date is not in fiscal year.")); set_focus('date'); return false; } if (!$Refs->is_valid($_POST['ref'])) { display_error(_("You must enter a reference.")); set_focus('ref'); return false; } if (!is_new_reference($_POST['ref'], ST_JOURNAL)) { display_error(_("The entered reference is already in use.")); set_focus('ref'); return false; } return true; }
function porto_page_title() { global $porto_settings; $output = ''; if (!is_front_page()) { } elseif (is_home()) { $output .= $porto_settings['blog-title']; } if (is_singular()) { $output .= porto_page_title_leaf(); } else { if (is_post_type_archive()) { if (is_search()) { $output .= porto_page_title_leaf('search'); } else { $output .= porto_page_title_archive(); } } elseif (is_tax() || is_tag() || is_category()) { $html = porto_page_title_leaf('term'); if (is_tag()) { $output .= sprintf(__('Tag - %s', 'porto'), $html); } elseif (is_tax('product_tag')) { $output .= sprintf(__('Product Tag - %s', 'porto'), $html); } else { $output .= $html; } } elseif (is_date()) { if (is_year()) { $output .= porto_page_title_leaf('year'); } elseif (is_month()) { $output .= porto_page_title_leaf('month'); } elseif (is_day()) { $output .= porto_page_title_leaf('day'); } } elseif (is_author()) { $output .= porto_page_title_leaf('author'); } elseif (is_search()) { $output .= porto_page_title_leaf('search'); } elseif (is_404()) { $output .= porto_page_title_leaf('404'); } elseif (class_exists('bbPress') && is_bbpress()) { if (bbp_is_search()) { $output .= porto_page_title_leaf('bbpress_search'); } elseif (bbp_is_single_user()) { $output .= porto_page_title_leaf('bbpress_user'); } else { $output .= porto_page_title_leaf(); } } else { if (is_home() && !is_front_page()) { if (get_option('show_on_front') == 'page') { $output .= get_the_title(get_option('page_for_posts', true)); } else { $output .= $porto_settings['blog-title']; } } } } return apply_filters('porto_page_title', $output); }
function can_process() { global $Refs; if (!is_date($_POST['CreditDate'])) { display_error(_("The entered date is invalid.")); set_focus('CreditDate'); return false; } elseif (!is_date_in_fiscalyear($_POST['CreditDate'])) { display_error(_("The entered date is not in fiscal year.")); set_focus('CreditDate'); return false; } if ($_SESSION['Items']->trans_no == 0) { if (!$Refs->is_valid($_POST['ref'])) { display_error(_("You must enter a reference.")); set_focus('ref'); return false; } } if (!check_num('ChargeFreightCost', 0)) { display_error(_("The entered shipping cost is invalid or less than zero.")); set_focus('ChargeFreightCost'); return false; } if (!check_quantities()) { display_error(_("Selected quantity cannot be less than zero nor more than quantity not credited yet.")); return false; } return true; }
function check_valid_entries() { if (!is_date($_POST['DatePaid'])) { display_error(tr("The entered date is invalid.")); set_focus('DatePaid'); return false; } if (!is_date_in_fiscalyear($_POST['DatePaid'])) { display_error(tr("The entered date is not in fiscal year.")); set_focus('DatePaid'); return false; } if (!check_num('amount', 0)) { display_error(tr("The entered amount is invalid or less than zero.")); set_focus('amount'); return false; } if (!references::is_valid($_POST['ref'])) { display_error(tr("You must enter a reference.")); set_focus('ref'); return false; } if (!is_new_reference($_POST['ref'], systypes::bank_transfer())) { display_error(tr("The entered reference is already in use.")); set_focus('ref'); return false; } if ($_POST['FromBankAccount'] == $_POST['ToBankAccount']) { display_error(tr("The source and destination bank accouts cannot be the same.")); set_focus('ToBankAccount'); return false; } return true; }
function ubik_title_archives() { if (is_category()) { $title = sprintf(__('%s archives', 'ubik'), single_cat_title('', false)); } elseif (is_tag()) { $title = sprintf(__('%s archives', 'ubik'), single_tag_title('', false)); } elseif (is_tax()) { $title = sprintf(__('%s archives', 'ubik'), single_term_title('', false)); } elseif (is_post_type_archive()) { $title = sprintf(__('%s archives', 'ubik'), post_type_archive_title('', false)); } elseif (is_author()) { $title = sprintf(__('Posts by %s', 'ubik'), get_the_author_meta('display_name', get_query_var('author'))); } elseif (is_date()) { if (get_query_var('second') || get_query_var('minute') || get_query_var('hour')) { $title = sprintf(__('%s archives', 'ubik'), get_the_time(__('g:i a', 'ubik'))); } elseif (is_day()) { $title = sprintf(__('%s daily archives', 'ubik'), get_the_date(_x('F j, Y', 'daily archives date format', 'ubik'))); } elseif (get_query_var('w')) { $title = sprintf(__('Week %1$s of %2$s archives', 'ubik'), get_the_time(__('W', 'ubik')), get_the_time(__('Y', 'ubik'))); } elseif (is_month()) { $title = sprintf(__('%s monthly archives', 'ubik'), get_the_date(_x('F Y', 'monthly archives date format', 'ubik'))); } elseif (is_year()) { $title = sprintf(__('%s yearly archives', 'ubik'), get_the_date(_x('Y', 'yearly archives date format', 'ubik'))); } else { $title = get_the_date(); } } else { $title = __('Archives', 'ubik'); } return apply_filters('ubik_title_archives', $title); }
/** * Test to see if the page is a date based archive page cpt archive * * @since 1.0.0 * @access public * @param * @return boolean */ public function isCptArchive() { if (is_category() || is_author() || is_tag() || is_date() || is_front_page() || is_home()) { return false; } return true; }
/** * Display breadcrumbs */ public function display() { if (Habakiri::get('is_displaying_bread_crumb') === 'false') { return; } global $wp_query; // Set to home $home_label = $this->get_home_label(); $this->set($home_label, home_url('/')); // Set to blog $post_type = $this->get_post_type(); if (is_category() || is_tag() || is_date() || is_author() || is_single() && $post_type === 'post') { $show_on_front = get_option('show_on_front'); $page_for_posts = get_option('page_for_posts'); if ($show_on_front === 'page' && $page_for_posts) { $this->set(get_the_title($page_for_posts), get_permalink($page_for_posts)); } } // Set current and ancestors if (is_404()) { $this->set_for_404(); } elseif (is_search()) { $this->set_for_search(); } elseif (is_tax()) { $this->set_for_tax(); } elseif (is_attachment()) { $this->set_for_attachment(); } elseif (is_page() && !is_front_page()) { $this->set_for_page(); } elseif (is_post_type_archive()) { $this->set_for_post_type_archive(); } elseif (is_single()) { $this->set_for_single(); } elseif (is_category()) { $this->set_for_category(); } elseif (is_tag()) { $this->set_for_tag(); } elseif (is_author()) { $this->set_for_author(); } elseif (is_day()) { $this->set_for_day(); } elseif (is_month()) { $this->set_for_month(); } elseif (is_year()) { $this->set_for_year(); } elseif (is_home() && !is_front_page()) { $this->set_for_blog(); } $bread_crumb = array(); $last_item = array_pop($this->bread_crumb); foreach ($this->bread_crumb as $_bread_crumb) { if (!empty($_bread_crumb['link'])) { $bread_crumb[] = sprintf('<a href="%s">%s</a>', esc_url($_bread_crumb['link']), esc_html($_bread_crumb['title'])); } else { $bread_crumb[] = esc_html($_bread_crumb['title']); } } $bread_crumb[] = sprintf('<strong>%s</strong>', $last_item['title']); printf('<div class="breadcrumbs">%s</div>', implode(' > ', apply_filters('habakiri_bread_crumb', $bread_crumb))); }
function get_archive_title() { $title = ""; $page_title = \get_the_archive_title(); if (\is_category()) { //カテゴリーページ $title = "『{$page_title』カテゴリーの記事}"; } elseif (\is_tag()) { //タグページ $title = "『{$page_title』タグが付けられた記事}"; } elseif (\is_tax()) { //タクソノミーページ $title = "『{$page_title』に分類された記事}"; } elseif (\is_author()) { //作成者ページ $title = "『{$page_title』が作成した記事}"; } elseif (\is_year() || \is_month() || \is_date()) { //年 $title = "{$page_titleに作成された記事}"; } else { //不明なアーカイブ $title = $page_title; } return $title; }
function can_process() { if (!is_date($_POST['date_'])) { display_error(tr("The entered date for the issue is invalid.")); set_focus('date_'); return false; } elseif (!is_date_in_fiscalyear($_POST['date_'])) { display_error(tr("The entered date is not in fiscal year.")); set_focus('date_'); return false; } if (!references::is_valid($_POST['ref'])) { display_error(tr("You must enter a reference.")); set_focus('ref'); return false; } if (!is_new_reference($_POST['ref'], 28)) { display_error(tr("The entered reference is already in use.")); set_focus('ref'); return false; } $failed_item = $_SESSION['issue_items']->check_qoh($_POST['Location'], $_POST['date_'], !$_POST['IssueType']); if ($failed_item != null) { display_error(tr("The issue cannot be processed because an entered item would cause a negative inventory balance :") . " " . $failed_item->stock_id . " - " . $failed_item->item_description); return false; } return true; }
function pass($post) { global $DT_TIME, $MOD; if (!is_array($post)) { return false; } if (!$post['catid']) { return $this->_(lang('message->pass_cate')); } if (strlen($post['title']) < 3) { return $this->_(lang('message->pass_title')); } if ($post['totime']) { if (!is_date($post['totime'])) { return $this->_(lang('message->pass_date')); } if (strtotime($post['totime'] . ' 23:59:59') < $DT_TIME) { return $this->_(lang('message->pass_todate')); } } if (DT_MAX_LEN && strlen($post['content']) > DT_MAX_LEN) { return $this->_(lang('message->pass_max')); } return true; }
function enlightenment_current_lead_posts() { $grids = enlightenment_archive_grids(); $grid = enlightenment_get_grid(enlightenment_current_grid()); if (1 == $grid['content_columns']) { $lead_posts = get_option('posts_per_page'); } elseif (is_home() && !is_page()) { $lead_posts = $grids['post']['lead_posts']; } elseif (is_author()) { $lead_posts = $grids['author']['lead_posts']; } elseif (is_date()) { $lead_posts = $grids['date']['lead_posts']; } elseif (is_post_type_archive()) { $lead_posts = $grids[get_query_var('post_type')]['lead_posts']; } elseif (is_category()) { $lead_posts = $grids['category']['lead_posts']; } elseif (is_tag()) { $lead_posts = $grids['post_tag']['lead_posts']; } elseif (is_tax('post_format')) { $lead_posts = $grids['post']['lead_posts']; } elseif (is_tax()) { $lead_posts = $grids[get_queried_object()->taxonomy]['lead_posts']; } elseif (is_search()) { $lead_posts = $grids['post']['lead_posts']; } return apply_filters('enlightenment_current_lead_posts', $lead_posts); }
function editar() { $id = $this->input->post('id_pedido'); $data = array('logged' => $this->auth->logged(), 'page_title' => 'Administração', 'titulo' => 'Pedido N° ' . $id, 'description' => 'Detalhes do pedido'); //caso a validação esteja ok if ($this->validation->run()) { $where = array('id_pedido' => $this->input->post('id_pedido')); $usar_ate = is_date($this->input->post('usar_ate')) ? $this->input->post('usar_ate') : null; $dados = array('usar_ate' => dateDb($usar_ate), 'limite' => $this->input->post('limite')); $dados = $this->input->xss_clean($dados); $this->product->updatePedido($where, $dados); $this->messages->add('Usuário atualizado com sucesso!', 'success'); // ser user message redirect('pedido/index/' . $id); die; } if ($this->auth->logged()) { $data['pedido'] = $this->user->getPedidosById($id); $this->validation->pedido_em = formataData('d/m/Y', $data['pedido']['pedido_em']); $this->validation->liberado_em = is_date(formataData('d/m/Y', $data['pedido']['liberado_em'])) ? formataData('d/m/Y', $data['pedido']['liberado_em']) : 'dd-mm-aaaa 00:00'; $this->validation->downloads = $data['pedido']['downloads']; $this->validation->usar_ate = is_date(formataData('d/m/Y', $data['pedido']['usar_ate'])) ? formataData('d/m/Y', $data['pedido']['usar_ate']) : 'dd-mm-aaaa'; $this->validation->limite = $data['pedido']['limite']; } $this->load->view('admin-pedido', $data); }
function pass($post) { global $DT_TIME, $MOD; if (!is_array($post)) { return false; } if (!$post['catid']) { return $this->_(lang('message->pass_cate')); } if (strlen($post['title']) < 3) { return $this->_(lang('message->pass_title')); } if (strlen($post['thumb']) < 15) { return $this->_(lang('message->pass_thumb')); } if (dround($post['price']) < 0.1) { return $this->_(lang('message->pass_group_price')); } if (dround($post['marketprice']) < 0.1) { return $this->_(lang('message->pass_group_mprice')); } if (dround($post['marketprice']) <= dround($post['price'])) { return $this->_(lang('message->pass_group_eprice')); } if ($post['totime']) { if (!is_date($post['totime'])) { return $this->_(lang('message->pass_date')); } if (strtotime($post['totime'] . ' 23:59:59') < $DT_TIME) { return $this->_(lang('message->pass_todate')); } } return true; }
function pesscore_config_get_utility_page_id() { $page_id = null; if (is_search()) { $page_id = of_get_option('template_page_id_search', null); } else { if (is_category()) { $page_id = of_get_option('template_page_id_blog_category', null); } else { if (is_tag()) { $page_id = of_get_option('template_page_id_blog_tags', null); } else { if (is_author()) { $page_id = of_get_option('template_page_id_author', null); } else { if (is_date() || is_day() || is_month() || is_year()) { $page_id = of_get_option('template_page_id_date', null); } else { if (is_tax('dt_portfolio_category')) { $page_id = of_get_option('template_page_id_portfolio_category', null); } else { if (is_tax('dt_gallery_category')) { $page_id = of_get_option('template_page_id_gallery_category', null); } } } } } } } return apply_filters('pesscore_config_get_utility_page_id', $page_id); }
function can_process() { if (!is_date($_POST['CreditDate'])) { display_error(tr("The entered date is invalid.")); set_focus('CreditDate'); return false; } elseif (!is_date_in_fiscalyear($_POST['CreditDate'])) { display_error(tr("The entered date is not in fiscal year.")); set_focus('CreditDate'); return false; } if ($_SESSION['Items']->trans_no == 0) { if (!references::is_valid($_POST['ref'])) { display_error(tr("You must enter a reference.")); set_focus('ref'); return false; } if (!is_new_reference($_POST['ref'], 11)) { display_error(tr("The entered reference is already in use.")); set_focus('ref'); return false; } } if (!check_num('ChargeFreightCost', 0)) { display_error(tr("The entered shipping cost is invalid or less than zero.")); set_focus('ChargeFreightCost'); return false; } return true; }
public function wp(WP $WP) { if (is_404() && ($class_name = $this->get_404_class_name())) { } elseif (is_search() && ($class_name = $this->get_search_class_name())) { } elseif (is_front_page() && ($class_name = $this->get_front_page_class_name())) { } elseif (is_home() && ($class_name = $this->get_home_class_name())) { } elseif (is_post_type_archive() && ($class_name = $this->get_post_type_archive_class_name())) { } elseif (is_tax() && ($class_name = $this->get_taxonomy_class_name())) { // elseif (is_attachment() && $class_name = $this->get_attachment_class_name()): } elseif (is_page() && ($class_name = $this->get_page_class_name())) { } elseif (is_single() && ($class_name = $this->get_single_class_name())) { } elseif (is_category() && ($class_name = $this->get_category_class_name())) { } elseif (is_tag() && ($class_name = $this->get_tag_class_name())) { } elseif (is_author() && ($class_name = $this->get_author_class_name())) { } elseif (is_date() && ($class_name = $this->get_date_class_name())) { // elseif (is_comments_popup() && $class_name = $this->get_comments_popup_class_name()): // elseif (is_paged() && $class_name = $this->get_paged_class_name()): } else { $class_name = $this->get_index_class_name(); } // must use Autoloader if ($class_name && class_exists($class_name)) { set_query_var($this->class_data['store_name'], new $class_name()); } return; }
function pass($post) { global $DT_TIME, $L; if (!is_array($post)) { return false; } if (!$post['title']) { return $this->_($L['honor_pass_title']); } if (!$post['authority']) { return $this->_($L['honor_pass_authority']); } if (!$post['thumb']) { return $this->_($L['honor_pass_thumb']); } if (!$post['fromtime'] || !is_date($post['fromtime'])) { return $this->_($L['honor_pass_fromdate']); } if (datetotime($post['fromtime'] . ' 00:00:00') > $DT_TIME) { return $this->_($L['honor_pass_fromdate_error']); } if ($post['totime']) { if (!is_date($post['totime'])) { return $this->_($L['honor_pass_todate']); } if (datetotime($post['totime'] . ' 23:59:59') < $DT_TIME) { return $this->_($L['honor_pass_todate_error']); } } return true; }
function can_process() { global $selected_id; if ($selected_id == -1) { if (!references::is_valid($_POST['ref'])) { display_error(tr("The dimension reference must be entered.")); set_focus('ref'); return false; } if (!is_new_reference($_POST['ref'], systypes::dimension())) { display_error(tr("The entered reference is already in use.")); set_focus('ref'); return false; } } if (strlen($_POST['name']) == 0) { display_error(tr("The dimension name must be entered.")); set_focus('name'); return false; } if (!is_date($_POST['date_'])) { display_error(tr("The date entered is in an invalid format.")); set_focus('date_'); return false; } if (!is_date($_POST['due_date'])) { display_error(tr("The required by date entered is in an invalid format.")); set_focus('due_date'); return false; } return true; }
function mypace_custom_navi_menu($classes, $item) { global $wp_query; $singular_slug = 'service'; $page_for_custom_type_title = 'サービス'; $page_for_posts = get_option('page_for_posts'); $post_type_query = $wp_query->query_vars['post_type']; $del_flag = true; $add_flag = false; if (is_singular('post') || is_category() || is_tag()) { $del_flag = false; } elseif (is_author() || is_date() || is_author()) { if (in_array($post_type_query, array('', 'post'))) { $del_flag = false; } elseif ($post_type_query == $custom_post_type) { $add_flag = true; } } elseif (is_tax()) { $taxonomy = get_taxonomy($wp_query->query_vars['taxonomy']); if (count($taxonomy->object_type) == 1 && $taxonomy->object_type[0] == 'post') { $del_flag = false; } elseif (count($taxonomy->object_type) == 1 && $taxonomy->object_type[0] == $singular_slug) { $add_flag = true; } } elseif (is_singular($singular_slug)) { $add_flag = true; } if ($del_flag && is_numeric($page_for_posts) && $item->object_id == $page_for_posts && $item->object == 'page' && ($key = array_search('current_page_parent', $classes))) { unset($classes[$key]); } elseif ($add_flag && $item->title == $page_for_custom_type_title && $item->object == 'page') { $classes[] = 'current_page_parent'; } return $classes; }
function cpotheme_page_title() { global $post; if (isset($post->ID)) { $current_id = $post->ID; } else { $current_id = false; } $title_tag = function_exists('is_woocommerce') && is_woocommerce() && is_singular('product') ? 'span' : 'h1'; echo '<' . $title_tag . ' class="pagetitle-title heading">'; if (function_exists('is_woocommerce') && is_woocommerce()) { woocommerce_page_title(); } elseif (is_category() || is_tag() || is_tax()) { echo single_tag_title('', true); } elseif (is_author()) { the_author(); } elseif (is_date()) { _e('Archive', 'brilliance'); } elseif (is_404()) { echo __('Page Not Found', 'brilliance'); } elseif (is_search()) { echo __('Search Results for', 'brilliance') . ' "' . get_search_query() . '"'; } else { echo get_the_title($current_id); } echo '</' . $title_tag . '>'; }
function pass($post) { global $DT_TIME, $MOD; if (!is_array($post)) { return false; } if (!$post['catid']) { return $this->_(lang('message->pass_catid')); } if (strlen($post['title']) < 3) { return $this->_(lang('message->pass_title')); } if ($post['totime']) { if (!is_date($post['totime'])) { return $this->_(lang('message->pass_date')); } if (strtotime($post['totime'] . ' 23:59:59') < $DT_TIME) { return $this->_(lang('message->pass_todate')); } } if (isset($post['islink'])) { if (!$post['linkurl']) { return $this->_(lang('message->pass_linkurl')); } } else { //if(!$post['content']) return $this->_(lang('message->pass_content')); } return true; }
/** * Runs through a list of secondary inserts according to page * Let users filter through the child theme if necessary * * @since 0.1 * @filter */ function hybrid_secondary_var() { if (is_front_page() || is_home()) { $hybrid_insert_id = __('Secondary Home', 'hybrid'); } elseif (is_author()) { $hybrid_insert_id = __('Secondary Author', 'hybrid'); } elseif (is_category()) { $hybrid_insert_id = __('Secondary Category', 'hybrid'); } elseif (is_date()) { $hybrid_insert_id = __('Secondary Date', 'hybrid'); } elseif (is_page_template('no-widgets.php')) { $hybrid_insert_id = false; } elseif (is_page()) { $hybrid_insert_id = __('Secondary Page', 'hybrid'); } elseif (is_search()) { $hybrid_insert_id = __('Secondary Search', 'hybrid'); } elseif (is_single()) { $hybrid_insert_id = __('Secondary Single', 'hybrid'); } elseif (is_tag()) { $hybrid_insert_id = __('Secondary Tag', 'hybrid'); } elseif (is_404()) { $hybrid_insert_id = __('Secondary 404', 'hybrid'); } else { $hybrid_insert_id = __('Secondary Home', 'hybrid'); } return apply_filters('hybrid_secondary_var', $hybrid_insert_id); }
function can_process() { global $Refs; if (!is_date($_POST['date_'])) { display_error(_("The entered date for the issue is invalid.")); set_focus('date_'); return false; } elseif (!is_date_in_fiscalyear($_POST['date_'])) { display_error(_("The entered date is not in fiscal year.")); set_focus('date_'); return false; } if (!$Refs->is_valid($_POST['ref'])) { display_error(_("You must enter a reference.")); set_focus('ref'); return false; } if (!is_new_reference($_POST['ref'], ST_MANUISSUE)) { display_error(_("The entered reference is already in use.")); set_focus('ref'); return false; } $failed_item = $_SESSION['issue_items']->check_qoh($_POST['Location'], $_POST['date_'], !$_POST['IssueType']); if ($failed_item != -1) { display_error(_("The issue cannot be processed because it would cause negative inventory balance for marked items as of document date or later.")); return false; } return true; }
function getWpTemplate() { if (defined('WP_USE_THEMES') && WP_USE_THEMES) { $template = false; if (is_404() && ($template = get_404_template())) { } elseif (is_search() && ($template = get_search_template())) { } elseif (is_tax() && ($template = get_taxonomy_template())) { } elseif (is_front_page() && ($template = get_front_page_template())) { } elseif (is_home() && ($template = get_home_template())) { } elseif (is_attachment() && ($template = get_attachment_template())) { } elseif (is_single() && ($template = get_single_template())) { } elseif (is_page() && ($template = get_page_template())) { } elseif (is_category() && ($template = get_category_template())) { } elseif (is_tag() && ($template = get_tag_template())) { } elseif (is_author() && ($template = get_author_template())) { } elseif (is_date() && ($template = get_date_template())) { } elseif (is_archive() && ($template = get_archive_template())) { } elseif (is_comments_popup() && ($template = get_comments_popup_template())) { } elseif (is_paged() && ($template = get_paged_template())) { } else { $template = get_index_template(); } return str_replace(ABSPATH, '', $template); } else { return null; } }
/** * Breadcrumbs * @return html * @source http://yootheme.com (Warp Themes) */ function basey_breadcrumbs() { global $wp_query; if (!is_home() && !is_front_page()) { $output = '<ul class="zz-link-more-muted zz-text-more-muted zz-position-up uk-breadcrumb uk-hidden-small">'; $output .= '<li><a href="' . get_option('home') . '">Home</a></li>'; if (is_single()) { $cats = get_the_category(); if ($cats) { $cat = $cats[0]; if (is_object($cat)) { if ($cat->parent != 0) { $cats = explode("@@@", get_category_parents($cat->term_id, true, "@@@")); unset($cats[count($cats) - 1]); $output .= str_replace('<li>@@', '<li>', '<li>' . implode("</li><li>", $cats) . '</li>'); } else { $output .= '<li><a href="' . get_category_link($cat->term_id) . '">' . $cat->name . '</a></li>'; } } } } if (is_category()) { $cat_obj = $wp_query->get_queried_object(); $cats = explode("@@@", get_category_parents($cat_obj->term_id, TRUE, '@@@')); unset($cats[count($cats) - 1]); $cats[count($cats) - 1] = '@@<span>' . strip_tags($cats[count($cats) - 1]) . '</span>'; $output .= str_replace('<li>@@', '<li class="uk-active">', '<li>' . implode("</li><li>", $cats) . '</li>'); } elseif (is_tag()) { $output .= '<li class="uk-active"><span>' . single_cat_title('', false) . '</span></li>'; } elseif (is_date()) { $output .= '<li class="uk-active"><span>' . single_month_title(' ', false) . '</span></li>'; } elseif (is_author()) { $user = get_user_by('login', get_the_author()); $output .= '<li class="uk-active"><span>' . $user->display_name . '</span></li>'; } elseif (is_search()) { $output .= '<li class="uk-active"><span>' . stripslashes(strip_tags(get_search_query())) . '</span></li>'; } elseif (is_tax()) { $taxonomy = get_taxonomy(get_query_var('taxonomy')); $term = get_query_var('term'); $output .= '<li class="uk-active"><span>' . $taxonomy->label . ': ' . $term . '</span></li>'; } else { if (!in_array(get_post_type(), array('post', 'page'))) { $cpt = get_post_type_object(get_post_type()); $output .= '<li><a href="' . get_post_type_archive_link(get_post_type()) . '">' . $cpt->labels->name . '</a></li>'; } $ancestors = get_ancestors(get_the_ID(), 'page'); for ($i = count($ancestors) - 1; $i >= 0; $i--) { $output .= '<li><a href="' . get_page_link($ancestors[$i]) . '" title="' . get_the_title($ancestors[$i]) . '">' . get_the_title($ancestors[$i]) . '</a></li>'; } $output .= '<li class="uk-active"><span>' . get_the_title() . '</span></li>'; } $output .= '</ul>'; } else { $output = '<ul class="uk-breadcrumb">'; $output .= '<li class="uk-active"><span>Home</span></li>'; $output .= '</ul>'; } echo $output; }
function meks_remove_wp_archives() { //If we are on category or tag or date or author archive if (is_category() || is_tag() || is_date() || is_author() || is_post_type_archive('hotel')) { global $wp_query; $wp_query->set_404(); //set to 404 not found page } }
function check_date() { if (!is_date(get_post('reconcile_date'))) { display_error(_("Invalid reconcile date format")); set_focus('reconcile_date'); return false; } return true; }
/** *存档页信息 *http://www.bgbk.org */ function Bing_archive_header() { if (!is_archive()) { return; } if (is_author()) { $dashicons = 'admin-users'; $name = $GLOBALS['authordata']->display_name; $description = get_the_author_meta('description'); $feed_link = get_author_feed_link($GLOBALS['authordata']->ID); } elseif (is_date()) { $dashicons = 'calendar'; if (is_day()) { $format = __('Y年m月d日', 'Bing'); } elseif (is_month()) { $format = __('Y年m月', 'Bing'); } else { $format = __('Y年', 'Bing'); } $name = get_the_date($format); $description = sprintf(__('%s发布的文章', 'Bing'), $name); } else { $dashicons = is_tag() ? 'tag' : 'category'; $name = single_term_title('', false); $description = term_description(); $feed_link = get_term_feed_link(get_queried_object_id(), get_queried_object()->taxonomy); } $description = strip_tags($description); ?> <div class="span12 archive-header"> <article class="panel"> <header class="panel-header"> <h3> <span class="dashicons dashicons-<?php echo $dashicons; ?> "></span><?php echo $name; ?> </h3> <?php if (Bing_mpanel('breadcrumbs')) { Bing_breadcrumbs('<span class="separator dashicons dashicons-arrow-right-alt2"></span>', '<span class="right breadcrumb"%s>', '</span>', '<span class="dashicons dashicons-admin-home"></span>' . __('首页', 'Bing')); } ?> </header> <?php echo empty($description) ? __('无描述', 'Bing') : $description; if (!empty($feed_link)) { printf('<a href="%s" title="%s" class="feed-link"><span class="dashicons dashicons-rss"></span></a>', esc_url($feed_link), esc_attr(__('此存档的 Feed 源,可以使用 RSS 阅读器订阅这些内容', 'Bing'))); } ?> </article> </div> <?php }
/** *AJAX 加载页面时某些情况重新加载侧边栏 *http://www.bgbk.org */ function Bing_ajax_load_page_refresh_sidebar() { if (!is_date()) { return; } ob_start(); get_sidebar(); Bing_ajax_load_page_save_sidebar_code(ob_get_clean()); add_filter('ajax_load_page_sidebar_code', 'Bing_ajax_load_page_save_sidebar_code', 12, 0); }
function check_eligibility($id, $info = NULL, $user_id = NULL) { $current_hook = current_filter(); if (!$user_id || !is_numeric($user_id)) { $user_id = get_current_user_id(); } $eligibility_option = get_option('wplms_mycred_eligibility'); foreach ($this->action_hooks as $module => $hooks) { foreach ($hooks as $set => $hook) { if ($current_hook == $hook) { if (is_array($eligibility_option[$module][$set])) { $point_criteria_ids = $eligibility_option[$module][$set]; } break; break; } } } //post ids are points criteria if (is_array($point_criteria_ids)) { foreach ($point_criteria_ids as $point_criteria_id) { $module_id = get_post_meta($point_criteria_id, 'wplms_module_id', true); if (isset($module_id) && is_numeric($module_id)) { if ($module_id != $id) { return; } } //echo '#1'; $expiry = get_post_meta($point_criteria_id, 'expires', true); if (isset($expiry) && is_date($expiry) && time() > strtotime($expiry)) { return; } //echo '#2'; $global_usage = get_post_meta($point_criteria_id, 'global', true); $total_usage = get_post_meta($point_criteria_id, 'total', true); if (isset($global_usage) && is_numeric($global_usage) && $total_usage > $global_usage) { return; } //echo '#3'; $user_usage = get_post_meta($point_criteria_id, 'user', true); $user_specific_usage = get_user_meta($user_id, $point_criteria_id, true); if (isset($user_usage) && is_numeric($user_usage) && $user_specific_usage > $user_usage) { return; } //echo '#4'; $operator = get_post_meta($point_criteria_id, 'wplms_module_score_operator', true); if ($current_hook == 'badgeos_wplms_unit_complete' || !isset($user_id)) { $user_id = get_current_user_id(); } if (isset($operator) && $operator) { $this->{$operator}($point_criteria_id, $id, $info, $user_id, $module, $total_usage, $user_specific_usage); } } } }