/** * Return a shortlink for a post, page, attachment, or blog. * * @since 1.0.0 */ public function getShortlink($shortlink, $id, $context, $allow_slugs) { if (ot_get_option('bitly_service_active') == 'no') { return false; } if (is_singular() && is_preview()) { return false; } global $wp_query; $post_id = ''; if ('query' == $context && is_singular()) { $post_id = $wp_query->get_queried_object_id(); } else { if ('post' == $context) { $post = get_post($id); $post_id = $post->ID; } } if ($shortlink = get_metadata('post', $post_id, '_bitly_shortlink', true)) { return $shortlink; } if (is_front_page() && !is_paged()) { return apply_filters('bitly_front_page', false); } $url = get_permalink($post_id); $domain = ot_get_option('bitly_domain'); $this->login(ot_get_option('bitly_login')); $this->apiKey(ot_get_option('bitly_api_key')); $shortlink = $this->shorten($url, $domain); if (!empty($shortlink)) { update_metadata('post', $post_id, '_bitly_shortlink', $shortlink); return $shortlink; } return false; }
/** * Prints HTML with meta information for the categories, tags and comments. */ function great_entry_footer() { // Featured Star if (is_sticky() && is_home() && !is_paged()) { printf('<span class="sticky-post"><i class="fa fa-star"></i> %s</span>', __('Featured', 'great')); } // Post Author if (get_theme_mod('display_post_author', 1)) { $byline = ' <span class="author vcard"> <a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '"> ' . esc_html(get_the_author()) . '</a></span>'; echo '<span class="byline"><i class="fa fa-user"></i> ' . $byline . '</span>'; } // Hide category and tag text for pages. if ('post' == get_post_type()) { /* translators: used between list items, there is a space after the comma */ $categories_list = get_the_category_list(__(', ', 'great')); if ($categories_list && great_categorized_blog() && get_theme_mod('display_post_cats', 1)) { printf('<span class="cat-links"><i class="fa fa-folder"></i> ' . '%1$s' . '</span>', $categories_list); } /* translators: used between list items, there is a space after the comma */ $tags_list = get_the_tag_list('', __(', ', 'great')); if ($tags_list and get_theme_mod('display_post_tags', 1)) { printf('<span class="tags-links"><i class="fa fa-tags"></i> ' . '%1$s' . '</span>', $tags_list); } } }
/** * Prints HTML with meta information for the current post-date/time, author, comment count and categories. */ function ultra_posted_on() { echo '<div class="entry-meta-inner">'; if (is_sticky() && is_home() && !is_paged()) { echo '<span class="featured-post">' . __('Sticky', 'ultra') . '</span>'; } if (is_home() && siteorigin_setting('blog_post_date') || is_archive() && siteorigin_setting('blog_post_date') || is_search() && siteorigin_setting('blog_post_date')) { echo '<span class="entry-date"><a href="' . esc_url(get_permalink()) . '" rel="bookmark"><time class="published" datetime="' . esc_attr(get_the_date('c')) . '">' . esc_html(get_the_date('j F Y')) . '</time><time class="updated" datetime="' . esc_attr(get_the_modified_date('c')) . '">' . esc_html(get_the_modified_date()) . '</time></span></a>'; } if (is_single() && siteorigin_setting('blog_post_date')) { echo '<span class="entry-date"><time class="published" datetime="' . esc_attr(get_the_date('c')) . '">' . esc_html(get_the_date('j F Y')) . '</time><time class="updated" datetime="' . esc_attr(get_the_modified_date('c')) . '">' . esc_html(get_the_modified_date()) . '</time></span>'; } if (siteorigin_setting('blog_post_author')) { echo '<span class="byline"><span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '" rel="author">' . esc_html(get_the_author()) . '</a></span></span>'; } if (comments_open() && siteorigin_setting('blog_post_comment_count')) { echo '<span class="comments-link">'; comments_popup_link(__('Leave a comment', 'ultra'), __('1 Comment', 'ultra'), __('% Comments', 'ultra')); echo '</span>'; } echo '</div>'; if (is_single() && siteorigin_setting('navigation_post_nav')) { the_post_navigation($args = array('prev_text' => '', 'next_text' => '')); } }
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; } }
function redirect_canonical($redirect_url, $requested_url) { if (is_singular('question') && is_paged()) { return false; } return $redirect_url; }
/** * Clause to add code to wp_head * * @since 1.3.3 * * @return string HTML added to the wp_head */ function bsearch_clause_head() { global $wp_query, $bsearch_settings; $bsearch_custom_CSS = stripslashes($bsearch_settings['custom_CSS']); $output = ''; if ($wp_query->is_search) { if ($bsearch_settings['seamless'] && !is_paged()) { $search_query = get_bsearch_query(); $output .= bsearch_increment_counter($search_query); } if ($bsearch_settings['meta_noindex']) { $output .= '<meta name="robots" content="noindex,follow" />'; } // Add custom CSS to header if ('' != $bsearch_custom_CSS) { $output .= '<style type="text/css">' . $bsearch_custom_CSS . '</style>'; } } /** * Filters the output HTML added to wp_head * * @since 2.0.0 * * @return string $output Output HTML added to wp_head */ $output = apply_filters('bsearch_clause_head', $output); echo $output; }
function ro_theme_author_render() { ob_start(); ?> <?php if (is_sticky() && is_home() && !is_paged()) { ?> <span class="featured-post"> <?php _e('Sticky', 'robusta'); ?> </span> <?php } ?> <div class="ro-about-author clearfix"> <div class="ro-author-avatar"><?php echo get_avatar(get_the_author_meta('ID'), 170); ?> </div> <div class="ro-author-info"> <h6 class="ro-name"><?php the_author(); ?> </h6> <?php the_author_meta('description'); ?> </div> </div> <?php return ob_get_clean(); }
function _act_get_body_data() { global $post; $body_data = array(); // echo 'pid'; // $post_type = get_post_type(get_the_ID()); if (is_archive()) { $post_type = "archive"; } if (is_front_page()) { $post_type = 'home'; } $body_data['post-type'] = $post_type; $post_slug = $post->post_name; if (is_archive() and isset(get_queried_object()->taxonomy)) { $tax = get_taxonomy(get_queried_object()->taxonomy); $post_slug = sanitize_title($tax->labels->singular_name); } elseif (is_archive() and !isset(get_queried_object()->taxonomy)) { $post_slug = get_queried_object()->name; } if (is_home()) { $post_slug = 'blog'; } if (is_home() && is_paged()) { $post_slug = 'blog_paged'; } $body_data['post-slug'] = $post_slug; return $body_data; }
function directory_theme_entry_meta() { if (is_sticky() && is_home() && !is_paged()) { printf('<span class="sticky-post">%s</span>', __('Featured', 'directory-starter')); } $format = get_post_format(); if (current_theme_supports('post-formats', $format)) { printf('<span class="entry-format">%1$s<a href="%2$s">%3$s</a></span>', sprintf('<span class="screen-reader-text">%s </span>', _x('Format', 'Used before post format.', 'directory-starter')), esc_url(get_post_format_link($format)), get_post_format_string($format)); } if (in_array(get_post_type(), array('post', 'attachment'))) { $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>'; $time_string = sprintf($time_string, esc_attr(get_the_date('c')), get_the_date(), esc_attr(get_the_modified_date('c')), get_the_modified_date()); printf('<span class="posted-on"><span class="screen-reader-text">%1$s </span><a href="%2$s" rel="bookmark">%3$s</a></span>', _x('Posted on', 'Used before publish date.', 'directory-starter'), esc_url(get_permalink()), $time_string); } if ('post' == get_post_type()) { if (is_singular() || is_multi_author()) { printf('<span class="byline"><span class="author vcard"><span class="screen-reader-text">%1$s </span><a class="url fn n" href="%2$s">%3$s</a></span></span>', _x('Author', 'Used before post author name.', 'directory-starter'), esc_url(get_author_posts_url(get_the_author_meta('ID'))), get_the_author()); } $categories_list = get_the_category_list(_x(', ', 'Used between list items, there is a space after the comma.', 'directory-starter')); if ($categories_list) { printf('<span class="cat-links"><span class="screen-reader-text">%1$s </span>%2$s</span>', _x('Categories', 'Used before category names.', 'directory-starter'), $categories_list); } $tags_list = get_the_tag_list('', _x(', ', 'Used between list items, there is a space after the comma.', 'directory-starter')); if ($tags_list) { printf('<span class="tags-links"><span class="screen-reader-text">%1$s </span>%2$s</span>', _x('Tags', 'Used before tag names.', 'directory-starter'), $tags_list); } } if (!is_single() && !post_password_required() && (comments_open() || get_comments_number())) { echo '<span class="comments-link">'; comments_popup_link(__('Leave a comment', 'directory-starter'), __('1 Comment', 'directory-starter'), __('% Comments', 'directory-starter')); echo '</span>'; } }
/** * kool_preview_boxes shows the next set of posts. It shows as many boxes as * you show posts on your blog page. This works best when there is an even * number of posts displayed (2,4,6,8,10) but it can work with an odd number * if alignment is set or if the width of boxes is set to 100% which would allow * for a column effct. * * To use kool_preview simply add the function call in your theme's index after * the content is displayed. I could technically go before as well. */ function kool_preview_boxes() { global $post; if (is_paged()) { $target_page = get_query_var('paged') + 1; } else { $target_page = 2; } $args = array('paged' => $target_page, 'orderby' => 'post_date', 'post_type' => 'post', 'post_status' => 'publish'); $k_posts = new WP_Query($args); if ($k_posts and $k_posts->have_posts()) { while ($k_posts->have_posts()) { $k_posts->the_post(); $thumb_query = array('numberposts' => 1, 'post_type' => 'attachment', 'post_parent' => $post->ID); echo '<div class="preview_box" >'; $attachment = get_posts($thumb_query); foreach ($attachment as $attach) { if ($attach) { $img = wp_get_attachment_image_src($attach->ID, $size = 'thumbnail', $icon = true); echo "<img class='preview_thumb' src='{$img['0']}' >"; } } echo '<a rel="bookmark" href='; the_permalink(); echo '>'; echo the_title() . '</a><br>'; the_excerpt(); echo "</div>"; } } }
function xtreme_meta_robots() { global $wp_query; if (is_paged() || is_archive() || is_tax() || is_author() || is_search() || is_category()) { echo '<meta name="robots" content="noindex, follow" />'; } }
function widget_sandbox_homelink($args) { extract($args); $options = get_option('widget_sandbox_homelink'); $title = empty($options['title']) ? __('« Home', 'chaostheory') : $options['title']; if (!is_home() || is_paged()) { ?> <?php echo $before_widget; ?> <?php echo $before_title; ?> <a href="<?php echo home_url(); ?> " title="<?php echo esc_attr(get_bloginfo('name')); ?> "><?php echo $title; ?> </a><?php echo $after_title; ?> <?php echo $after_widget; } }
function document_title($title = '', $sep = '-', $seplocation = 'right') { // Remove default seperator and add spacing if (trim($sep) === '' || $sep === '»' || $sep === '»') { $sep = '-'; } $sep = ' ' . $sep . ' '; // Determine page number, if any $page_num = ''; if (is_paged()) { global $page, $paged; if ($paged >= 2 || $page >= 2) { $page_num = $sep . sprintf(esc_html__('Page %d', 'ubik'), max($paged, $page)); } } // Generate the title using our all-purpose title function $title = apply_filters('ubik_seo_document_title_raw', ubik_title()); $name = get_bloginfo('name'); $desc = get_bloginfo('description'); // Handle three scenarios: home/front page, archive feeds, and everything else if (is_front_page() || is_home()) { $title = $name; if (!empty($desc) && !is_paged()) { $title .= $sep . $desc; } } elseif (is_feed() && is_archive()) { $title = $sep . $title; // Adding the separator alters the default archive feed title output } else { $title = $title . $sep . $name; } // Sanitize and add page number as needed $title = esc_html(strip_tags(stripslashes(preg_replace('/\\s+/', ' ', trim($title . $page_num))))); return apply_filters('ubik_seo_document_title_final', $title); }
function widget($args, $instance) { global $post; extract($args, EXTR_SKIP); echo $before_widget; $title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']); if (!empty($title)) { echo $before_title . $title . $after_title; } if ((is_home() || is_front_page()) && !is_paged() && !ceo_pluginfo('disable_comic_on_home_page')) { $chapter_on_home = ''; $chapter_on_home = get_term_by('id', ceo_pluginfo('chapter_on_home'), 'chapters'); $chapter_on_home = !is_wp_error($chapter_on_home) && !empty($chapter_on_home) ? '&chapters=' . $chapter_on_home->slug : ''; $order = ceo_pluginfo('display_first_comic_on_home_page') ? 'asc' : 'desc'; $query_args = 'post_type=comic&showposts=1&order=' . $order . $chapter_on_home; apply_filters('ceo_display_comic_mininav_home_query', $query_args); $comicFrontpage = new WP_Query(); $comicFrontpage->query($query_args); while ($comicFrontpage->have_posts()) { $comicFrontpage->the_post(); ceo_list_jump_to_comic($instance['exclude'], false); } } elseif (!empty($post)) { ceo_list_jump_to_comic($instance['exclude'], false); } echo $after_widget; }
/** * Prints HTML with meta information for the categories, tags. * * @since Pure 1.0 */ function pure_entry_meta() { if (is_sticky() && is_home() && !is_paged()) { printf('<span class="sticky-post">%s</span>', __('Featured', 'pure')); } if ('post' == get_post_type()) { printf('<span class="byline"><span class="author vcard"><i class="fa fa-user"></i><span class="screen-reader-text">%1$s </span><a class="url fn n" href="%2$s">%3$s</a></span></span>', _x('Author', 'Used before post author name.', 'pure'), esc_url(get_author_posts_url(get_the_author_meta('ID'))), get_the_author()); } if (in_array(get_post_type(), array('post', 'attachment'))) { $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>'; /*$time_string = sprintf( $time_string, esc_attr( get_the_date( 'c' ) ), is_single() ? pure_get_time_ago( get_post_time( 'c', true ) ), esc_attr( get_the_modified_date( 'c' ) ), get_the_modified_date() );*/ $time_string = sprintf($time_string, esc_attr(get_the_date('c')), get_the_date(), esc_attr(get_the_modified_date('c')), get_the_modified_date()); printf('<span class="posted-on"><span class="screen-reader-text">%1$s </span><i class="fa fa-clock-o"></i><a href="%2$s" rel="bookmark">%3$s</a></span>', _x('Posted on', 'Used before publish date.', 'pure'), esc_url(get_permalink()), $time_string); } if (!is_single() && !post_password_required() && (comments_open() || get_comments_number())) { echo '<span class="comments-link"><i class="fa fa-comment-o"></i>'; comments_popup_link(__('Leave a comment', 'pure'), __('1 Comment', 'pure'), __('% Comments', 'pure')); echo '</span>'; } return; }
function scriptsStyles() { global $wp_query, $wipOptions, $wipDynamicMeta, $wipLayoutMeta; $wipOptions = get_option('wipOptions'); if (is_single()) { $postID = $wp_query->post->ID; $wipDynamicMeta = get_post_meta($postID, '_dynamic', true); $wipLayoutMeta = get_post_meta($postID, '_layout', true); } wp_enqueue_style('wipStyle', get_stylesheet_uri()); wp_enqueue_style('shadowboxStyle', get_template_directory_uri() . '/css/shadowbox.css'); wp_enqueue_script('jquery'); if (is_singular() && get_option('thread_comments')) { wp_enqueue_script('comment-reply'); } wp_enqueue_script('wipjsRespond', get_template_directory_uri() . '/js/respond.min.js', array(), null); wp_enqueue_script('wipjsShadowbox', get_template_directory_uri() . '/js/shadowbox.js', array(), null); wp_enqueue_script('wipjsInit', get_template_directory_uri() . '/js/init.js', array(), null, true); if (isset($wipLayoutMeta['page_type']) && $wipLayoutMeta['page_type'] == 'dynamic' && isset($wipLayoutMeta['slideshow']) && $wipLayoutMeta['slideshow'] == 'show' && $wipDynamicMeta['wipHomeArray'] != '' || is_front_page() && isset($wipOptions['indexSlide']) && isset($wipOptions['slidesCategory']) && isset($wipOptions['slideCount']) && !is_paged()) { $buttonSrc = get_template_directory_uri() . '/images/button-w.png'; wp_register_script('wipjsSlideshow', get_template_directory_uri() . '/js/slideshow.js', array(), null); wp_enqueue_script('wipjsSlideshow'); wp_localize_script('wipjsSlideshow', 'buttonSrc', $buttonSrc); } if ($wipOptions['tbPrintLink']) { $printCSS = get_template_directory_uri() . '/css/print.css'; wp_register_script('wsujsPrint', get_template_directory_uri() . '/js/print.js', array(), null); wp_enqueue_script('wsujsPrint'); wp_localize_script('wsujsPrint', 'printCSS', $printCSS); } }
/** * Prints HTML with meta information for current post: categories, tags, permalink, author, and date. * * @return void */ function wheels_entry_meta() { if (is_sticky() && is_home() && !is_paged()) { echo '<span class="featured-post">' . __('Sticky', 'wheels') . '</span>'; } if (!has_post_format('link') && 'post' == get_post_type()) { wheels_entry_date(); } // Translators: used between list items, there is a space after the comma. $categories_list = get_the_category_list(__(', ', 'wheels')); if ($categories_list) { echo '/<span class="categories-links">' . $categories_list . '</span>'; } // Translators: used between list items, there is a space after the comma. $tag_list = get_the_tag_list('', __(', ', 'wheels')); if ($tag_list) { echo '/<span class="tags-links">' . $tag_list . '</span>'; } // Post author if ('post' == get_post_type()) { printf('/<span class="author vcard">%1$s <a class="url fn n" href="%2$s" title="%3$s" rel="author">%4$s</a></span>', __('by', 'wheels'), esc_url(get_author_posts_url(get_the_author_meta('ID'))), esc_attr(sprintf(__('View all posts by %s', 'wheels'), get_the_author())), get_the_author()); $num_comments = get_comments_number(); // get_comments_number returns only a numeric value if ($num_comments == 0) { } else { if ($num_comments > 1) { $comments = $num_comments . __(' Comments', 'wheels'); } else { $comments = __('1 Comment', 'wheels'); } echo $write_comments = '/<span class="comments-count"><a href="' . get_comments_link() . '">' . $comments . '</a></span>'; } } }
/** * Creates a set of classes for each site entry upon display. Each entry is given the class of * 'hentry'. Posts are given category, tag, and author classes. Alternate post classes of odd, * even, and alt are added. * * @param string|array $class One or more classes to add to the class list. * @param int $post_id An optional post ID. * @return array * @since 1.1 */ function momtaz_get_post_class($class = '', $post_id = 0) { $classes = array(); // Get post object $post = get_post($post_id); if (empty($post)) { return $classes; } // hAtom compliance. $classes[] = 'hentry'; // Get post context. $context = momtaz_get_post_context($post_id); // Merge the classes array with post context. $classes = array_merge($classes, (array) $context); // Post taxonomies $post_taxonomies = get_post_taxonomies($post); if (!empty($post_taxonomies)) { foreach ($post_taxonomies as $taxonomy) { $terms = get_the_terms($post->ID, $taxonomy); if (!empty($terms)) { foreach ($terms as $term) { $classes[] = 'term-' . sanitize_html_class($term->slug, $term->term_id); } } } } // Sticky posts. if (is_home() && !is_paged() && is_sticky($post->ID)) { $classes[] = 'sticky'; } // Is this post protected by a password? if (post_password_required($post)) { $classes[] = 'post-password-required'; } // Post alt class. if (!momtaz_is_the_single($post)) { static $post_alt = 0; $classes[] = 'set-' . ++$post_alt; $classes[] = $post_alt % 2 ? 'odd' : 'even'; } // Has a custom excerpt? if (has_excerpt($post)) { $classes[] = 'has-excerpt'; } // Custom classes. if (!empty($class)) { if (!is_array($class)) { $class = preg_split('#\\s+#', $class); } $classes = array_merge($classes, $class); } // Apply the WordPress filters. $classes = apply_filters('post_class', $classes, $class, $post->ID); // Apply the Momtaz FW filters. $classes = apply_filters('momtaz_get_post_class', $classes, $post); // Removes any duplicate and empty classes. $classes = array_unique(array_filter($classes)); return $classes; }
function is_ads_list_in_middle_on_top_page_enable($count) { // var_dump(is_category()); // var_dump(get_the_category()[0]->count >= 5); if ($count == 3 && is_home() && !is_paged() && (is_mobile() || is_responsive_enable()) && intval(get_option('posts_per_page')) >= 6 && !is_ads_sidebar_top() && is_ads_performance_visible() && !is_list_style_tile_thumb_cards() && is_ads_top_page_visible() && get_all_post_count_in_publish() > 3) { return true; } }
/** * Print HTML with meta information for the current post-date/time and author. * * @since 2.2.0 * * @return void */ function vulcano_posted_on() { if (is_sticky() && is_home() && !is_paged()) { echo '<span class="featured-post">' . __('Sticky', 'vulcano') . ' </span>'; } // Set up and print post meta information. printf('<span class="entry-date">%s <time class="entry-date" datetime="%s">%s</time></span> <span class="byline">%s <span class="author vcard"><a class="url fn n" href="%s" rel="author">%s</a></span>.</span>', __('Posted in', 'vulcano'), esc_attr(get_the_date('c')), esc_html(get_the_date()), __('by', 'vulcano'), esc_url(get_author_posts_url(get_the_author_meta('ID'))), get_the_author()); }
function wp_cache_set_home() { global $wp_cache_is_home; $wp_cache_is_home = is_front_page() || is_home(); if ($wp_cache_is_home && is_paged()) { $wp_cache_is_home = false; } }
/** * Print HTML with meta information for the current post-date/time and author. * * @since Anciela 1.0 */ function anciela_posted_on() { // Set up and print post meta information. printf('<time class="entry-date" datetime="%1$s">%2$s</time>', esc_attr(get_the_date('c')), esc_html(get_the_date())); if (is_sticky() && is_home() && !is_paged()) { echo '<span class="featured-post">' . __('Actualité à la une', 'anciela') . '</span>'; } }
function alfath_add_class_last_post($classes) { global $query; if ($query->current_post === 0 && !is_paged()) { $classes[] = 'sticky'; } return $classes; }
/** * Print HTML with meta information for the current post-date/time and author. * * @since Twenty Fourteen 1.0 */ function rms_posted_on() { if (is_sticky() && is_home() && !is_paged()) { echo '<span class="featured-post">' . __('Sticky', 'deepocean') . '</span>'; } // Set up and print post meta information. printf('<span class="entry-date"><a href="%1$s" rel="bookmark"><time class="entry-date" datetime="%2$s">%3$s</time></a></span> <span class="byline"><span class="author vcard"><a class="url fn n" href="%4$s" rel="author">%5$s</a></span></span>', get_permalink(), esc_attr(get_the_date('c')), esc_html(get_the_date()), get_author_posts_url(get_the_author_meta('ID')), get_the_author()); }
function odin_posted_small() { if (is_sticky() && is_home() && !is_paged()) { echo '<span class="featured-post">' . __('Sticky', 'morfeu') . ' </span>'; } // Set up and print post meta information. printf('<span class="entry-date"> <i class="icon-circle glyphicon glyphicon-calendar"></i> <time class="entry-date" datetime="%s">%s</time></span>', esc_attr(get_the_date('c')), esc_html(get_the_date())); }
function no_sidebar_body_class($classes) { $current_page = is_paged() ? get_query_var('paged') : 1; if (1 == $current_page) { $classes[] = 'first-page'; } $classes[] = 'front-page'; return $classes; }
function woo_custom_load_biz_slider() { if (is_front_page() && !is_paged()) { add_action('woo_main_before_home', 'woo_slider_biz', 10); add_action('woo_main_before_home', 'woo_custom_reset_biz_query', 11); add_action('woo_load_slider_js', '__return_true', 10); add_filter('body_class', 'woo_custom_add_business_bodyclass', 10); } }
function setupContentTypeActionBox() { global $wp_query; $MabBase = MAB(); $is_paged = is_paged(); if ($is_paged) { /** * Get query var "page" as some page templates may use this on custom queries and calling * get_queried_object() method seems to override this i.e. optimize press on Blog Template **/ $paged = get_query_var('paged'); /** * If on static front page, need to check 'page' * @source https://codex.wordpress.org/Pagination#static_front_page */ if (empty($paged)) { $paged = get_query_var('page'); } } $post = $wp_query->get_queried_object(); //stop if the content type is not supposed to show action box if ((!is_object($post) || !isset($post->post_type) || !$MabBase->is_allowed_content_type($post->post_type)) && !(is_home() && $wp_query->post_count == 1)) { return; } //Show Action box only on singular pages or when it is on blog index but set only to show //one blog post. if (is_singular() && is_main_query() || is_home() && $wp_query->post_count == 1) { $mab_priority = $this->_the_content_filter_priority; //default 10. //TODO: have option to disable removal of filter // Disable WordPress native formatters $settings = $this->MAB('settings')->getAll(); if (!empty($settings['others']['reorder-content-filters'])) { remove_filter('the_content', 'wpautop'); remove_filter('the_content', 'wptexturize'); add_filter('the_content', 'wpautop', 8); add_filter('the_content', 'wptexturize', 8); $mab_priority = 9; } $this->setUpDefaults(); $queried_mab_obj = $this->getQueriedActionBoxObj(); if (is_object($queried_mab_obj) && !empty($queried_mab_obj)) { //TODO: check if page has action box //add_action( 'wp_print_styles', array( &$this, 'printStylesScripts' ) ); add_action('wp_enqueue_scripts', array(&$this, 'printStylesScripts')); add_filter("the_content", array(&$this, 'showActionBox'), $mab_priority); } } if ($is_paged) { /** * Set the 'paged' parameter as it may have been overwritten by call to * get_queried_object() above */ set_query_var('paged', $paged); } }
/** * force WordPress to return a 404. */ function custom_paged_404_fix() { global $wp_query; if (is_404() || !is_paged() || 0 != count($wp_query->posts)) { return; } $wp_query->set_404(); status_header(404); nocache_headers(); }
/** * Build the list of templates */ public function __construct() { if (is_404()) { $this->get_404_template(); } if (is_search()) { $this->get_search_template(); } if (is_front_page()) { $this->get_front_page_template(); } if (is_home()) { $this->get_home_template(); } if (is_post_type_archive()) { $this->get_post_type_archive_template(); } if (is_tax()) { $this->get_taxonomy_template(); } if (is_attachment()) { $this->get_attachment_template(); } remove_filter('the_content', 'prepend_attachment'); if (is_single()) { $this->get_single_template(); } if (is_page()) { $this->get_page_template(); } if (is_singular()) { $this->get_singular_template(); } if (is_category()) { $this->get_category_template(); } if (is_tag()) { $this->get_tag_template(); } if (is_author()) { $this->get_author_template(); } if (is_date()) { $this->get_date_template(); } if (is_archive()) { $this->get_archive_template(); } if (is_paged()) { $this->get_paged_template(); } if (!is_404()) { $this->get_index_template(); } }