Ejemplo n.º 1
2
function base_getBreadcrumbs()
{
    if (is_404()) {
        return false;
    }
    // Hack to fix breadcrumbs when you're viewing the news home
    if (is_home()) {
        $post = new \Timber\Post(get_option('page_for_posts'));
    } else {
        global $post;
    }
    $breadcrumbs = [];
    if ($post->post_parent) {
        $parent_id = $post->post_parent;
        while ($parent_id) {
            $page = get_page($parent_id);
            $breadcrumbs[] = new \Timber\Post($page->ID);
            $parent_id = $page->post_parent;
        }
        $breadcrumbs = array_reverse($breadcrumbs);
    }
    // Add 'Blog Home' to breadcrumbs if you're on a news post or archive
    if ((is_single() || is_archive()) && !is_search()) {
        $breadcrumbs[] = new \Timber\Post(get_option('page_for_posts'));
    }
    return $breadcrumbs;
}
Ejemplo n.º 2
1
/**
 * Filters the main query on homepage
 */
function et_home_posts_query($query = false)
{
    /* Don't proceed if it's not homepage or the main query */
    if (!is_home() || !is_a($query, 'WP_Query') || !$query->is_main_query()) {
        return;
    }
    if ('false' == et_get_option('feather_blog_style', 'false')) {
        if ('on' == et_get_option('feather_display_recentwork_section', 'on')) {
            $query->set('posts_per_page', (int) et_get_option('feather_posts_media', '8'));
            $exclude_media_categories = et_get_option('feather_exlcats_media', false);
            if ($exclude_media_categories) {
                $query->set('category__not_in', array_map('intval', et_generate_wpml_ids($exclude_media_categories, 'category')));
            }
        }
        return;
    }
    /* Set the amount of posts per page on homepage */
    $query->set('posts_per_page', (int) et_get_option('feather_homepage_posts', '6'));
    /* Exclude categories set in ePanel */
    $exclude_categories = et_get_option('feather_exlcats_recent', false);
    if ($exclude_categories) {
        $query->set('category__not_in', array_map('intval', et_generate_wpml_ids($exclude_categories, 'category')));
    }
    /* Exclude slider posts, if the slider is activated, pages are not featured and posts duplication is disabled in ePanel  */
    if ('on' == et_get_option('feather_featured', 'on') && 'false' == et_get_option('feather_use_pages', 'false') && 'false' == et_get_option('feather_duplicate', 'on')) {
        $query->set('post__not_in', et_get_featured_posts_ids());
    }
}
Ejemplo n.º 3
0
function baw_hack_wp_title_for_home($title)
{
    if (empty($title) && (is_home() || is_front_page())) {
        return __('Home', 'theme_domain') . ' | ' . get_bloginfo('description');
    }
    return $title;
}
Ejemplo n.º 4
0
/**
 * Get custom page header template part, will apply on top of post/page
 */
function wpsp_page_header()
{
    if (is_home() || is_front_page() || is_page_template('templates/homepage.php') || is_page_template('templates/contact.php')) {
        return;
    }
    get_template_part('template-parts/page-header');
}
function expose_home_layout($opt)
{
    if (is_home()) {
        $opt = 'full-width-content';
    }
    return $opt;
}
Ejemplo n.º 6
0
function wpdocs_hack_wp_title_for_home($title)
{
    if (empty($title) && (is_home() || is_front_page())) {
        $title = __(get_bloginfo('title'), 'textdomain') . ' | ' . get_bloginfo('description');
    }
    return $title;
}
Ejemplo n.º 7
0
function um_access_global_settings()
{
    global $post, $ultimatemember;
    $access = um_get_option('accessible');
    if ($access == 2 && !is_user_logged_in()) {
        $redirect = um_get_option('access_redirect');
        if (!$redirect) {
            $redirect = um_get_core_page('login');
        }
        $redirects[] = untrailingslashit(um_get_core_page('login'));
        $redirects[] = untrailingslashit(um_get_option('access_redirect'));
        $exclude_uris = um_get_option('access_exclude_uris');
        if ($exclude_uris) {
            $redirects = array_merge($redirects, $exclude_uris);
        }
        $redirects = array_unique($redirects);
        $current_url = $ultimatemember->permalinks->get_current_url(get_option('permalink_structure'));
        $current_url = untrailingslashit($current_url);
        $current_url_slash = trailingslashit($current_url);
        if ((isset($post->ID) || is_home()) && (in_array($current_url, $redirects) || in_array($current_url_slash, $redirects))) {
            // allow
        } else {
            $ultimatemember->access->redirect_handler = $redirect;
        }
    }
}
Ejemplo n.º 8
0
function dess_page_title($title)
{
    if (empty($title) && (is_home() || is_front_page())) {
        return __('Home', 'pro-blogg') . ' | ' . get_bloginfo('description');
    }
    return $title;
}
Ejemplo n.º 9
0
function streamline_newsletter()
{
    if (!is_home()) {
        return;
    }
    genesis_widget_area('newsletter', array('before' => '<div class="newsletter widget-area">'));
}
Ejemplo n.º 10
0
 function test_sp_query_arg()
 {
     $this->go_to('/?sp[force]=1');
     $this->assertEquals(get_query_var('sp'), array('force' => '1'));
     $this->assertTrue(is_search());
     $this->assertFalse(is_home());
 }
function education_home_layout($opt)
{
    if (is_home()) {
        $opt = 'content-sidebar-sidebar';
    }
    return $opt;
}
Ejemplo n.º 12
0
 /**
  * Helper function to check whether the shortcode should be rendered or not
  *
  * @return type
  */
 static function display_allowed()
 {
     global $rtmedia_query;
     $flag = !(is_home() || is_post_type_archive() || is_author()) && is_user_logged_in() && (is_rtmedia_upload_music_enabled() || is_rtmedia_upload_photo_enabled() || is_rtmedia_upload_video_enabled()) && (isset($rtmedia_query->is_upload_shortcode) && $rtmedia_query->is_upload_shortcode == true || is_rtmedia_bp_profile() && is_rtmedia_profile_media_enable() || is_rtmedia_bp_group() && is_rtmedia_group_media_enable());
     $flag = apply_filters('before_rtmedia_uploader_display', $flag);
     return $flag;
 }
Ejemplo n.º 13
0
function family_banner()
{
    ?>
	<div class="banner">
		<div class="wrap">
			<?php 
    if (is_front_page()) {
        family_get_header_image();
    } elseif (!is_front_page() && get_theme_mod('family_header_home')) {
        echo '';
    } else {
        // get title
        $id = get_option('page_for_posts');
        if ('posts' == get_option('show_on_front') && (is_day() || is_month() || is_year() || is_tag() || is_category() || is_singular('post') || is_home())) {
            family_get_header_image();
        } elseif (is_home() || is_singular('post')) {
            if (has_post_thumbnail($id)) {
                echo get_the_post_thumbnail($id, 'full');
            } else {
                family_get_header_image();
            }
        } elseif (has_post_thumbnail() && is_singular('page')) {
            the_post_thumbnail();
        } else {
            family_get_header_image();
        }
    }
    ?>
		</div><!-- .wrap -->
  	</div><!-- .banner -->
<?php 
}
Ejemplo n.º 14
0
function wpthemes_post_class($class = '', $post_id = null)
{
    $post = get_post($post_id);
    $classes = array();
    $classes[] = $post->post_type;
    if (is_sticky($post->ID) && is_home()) {
        $classes[] = 'sticky';
    }
    $classes[] = 'hentry';
    foreach ((array) get_the_category($post->ID) as $cat) {
        if (empty($cat->slug)) {
            continue;
        }
        $classes[] = 'category-' . $cat->slug;
    }
    foreach ((array) get_the_tags($post->ID) as $tag) {
        if (empty($tag->slug)) {
            continue;
        }
        $classes[] = 'tag-' . $tag->slug;
    }
    if (!empty($class)) {
        if (!is_array($class)) {
            $class = preg_split('#\\s+#', $class);
        }
        $classes = array_merge($classes, $class);
    }
    return apply_filters('post_class', $classes, $class, $post_id);
}
Ejemplo n.º 15
0
 public function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
 {
     $indent = $depth ? str_repeat("\t", $depth) : '';
     $class_names = $value = '';
     $classes = empty($item->classes) ? array() : (array) $item->classes;
     $class_names = \join(' ', \apply_filters('nav_menu_css_class', \array_filter($classes), $item));
     $class_names = ' class="' . \esc_attr($class_names) . '"';
     $output .= $indent . '<li id="menu-item-' . $item->ID . '"' . $value . $class_names . '>';
     $attributes = !empty($item->attr_title) ? ' title="' . \esc_attr($item->attr_title) . '"' : '';
     $attributes .= !empty($item->target) ? ' target="' . \esc_attr($item->target) . '"' : '';
     $attributes .= !empty($item->xfn) ? ' rel="' . \esc_attr($item->xfn) . '"' : '';
     if ($item->object == 'page') {
         $varpost = \get_post($item->object_id);
         if (\is_home()) {
             $attributes .= ' href="#' . $varpost->post_name . '"';
         } else {
             $attributes .= ' href="' . \home_url() . '/#' . $varpost->post_name . '"';
         }
     } else {
         $attributes .= !empty($item->url) ? ' href="' . \esc_attr($item->url) . '"' : '';
     }
     $item_output = $args->before;
     $item_output .= '<a' . $attributes . '>';
     $item_output .= $args->link_before . \apply_filters('the_title', $item->title, $item->ID);
     $item_output .= $args->link_after;
     $item_output .= '</a>';
     $item_output .= $args->after;
     $output .= \apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args);
 }
Ejemplo n.º 16
0
function lifestyle_banner()
{
    ?>
	<div class="banner">
		<div class="wrap">
			<?php 
    if (is_front_page()) {
        lifestyle_get_home_banner();
    } elseif (!is_front_page() && get_theme_mod('lifestyle_header_home')) {
        echo '';
    } else {
        // get title
        $id = get_option('page_for_posts');
        if (is_home() || is_singular('post')) {
            if (has_post_thumbnail($id)) {
                echo get_the_post_thumbnail($id, 'full');
            }
        } elseif (has_post_thumbnail() && is_singular('page')) {
            the_post_thumbnail();
        }
    }
    ?>
		</div><!-- .wrap -->
  	</div><!-- .banner -->
<?php 
}
Ejemplo n.º 17
0
 function woothemes_add_javascript()
 {
     $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
     wp_enqueue_script('third-party', get_template_directory_uri() . '/includes/js/third-party' . $suffix . '.js', array('jquery'));
     wp_register_script('flexslider', get_template_directory_uri() . '/includes/js/jquery.flexslider' . $suffix . '.js', array('jquery'));
     wp_register_script('prettyPhoto', get_template_directory_uri() . '/includes/js/jquery.prettyPhoto' . $suffix . '.js', array('jquery'));
     wp_register_script('portfolio', get_template_directory_uri() . '/includes/js/portfolio' . $suffix . '.js', array('jquery', 'prettyPhoto'));
     wp_enqueue_script('modernizr', get_template_directory_uri() . '/includes/js/modernizr' . $suffix . '.js', array('jquery'), '2.6.2');
     // Conditionally load the Slider and Portfolio JavaScript, where needed.
     $load_slider_js = false;
     $load_portfolio_js = false;
     if (get_option('woo_slider_magazine') == 'true' && is_page_template('template-magazine.php') || get_option('woo_slider_biz') == 'true' && is_page_template('template-biz.php') || is_page_template('template-widgets.php') || is_active_sidebar('homepage') && (is_home() || is_front_page())) {
         $load_slider_js = true;
     }
     if (is_page_template('template-portfolio.php') || is_singular() && get_post_type() == 'portfolio' || is_post_type_archive('portfolio') || is_tax('portfolio-gallery')) {
         $load_portfolio_js = true;
     }
     // Allow child themes/plugins to load the slider and portfolio JavaScript when they need it.
     $load_slider_js = apply_filters('woo_load_slider_js', $load_slider_js);
     $load_portfolio_js = apply_filters('woo_load_portfolio_js', $load_portfolio_js);
     if ($load_slider_js) {
         wp_enqueue_script('flexslider');
     }
     if ($load_portfolio_js) {
         wp_enqueue_script('portfolio');
     }
     do_action('woothemes_add_javascript');
     wp_enqueue_script('general', get_template_directory_uri() . '/includes/js/general' . $suffix . '.js', array('jquery', 'third-party'));
 }
Ejemplo n.º 18
0
function gc_enterprise_bp_head()
{
    remove_action('genesis_after_footer', 'bp_core_admin_bar', 88);
    if (gconnect_have_adminbar() && (!is_home() || gconnect_get_option('adminbar'))) {
        add_action('genesis_after_footer', 'gc_enterprise_adminbar', 88);
    }
}
 function wpex_blog_exclude_categories()
 {
     // Wait..we don't want to be in these plages? Lets leave now!
     if (is_admin()) {
         return;
     }
     if (is_search()) {
         return;
     }
     if (is_archive()) {
         return;
     }
     // Categories to exclude
     $cats_to_exclude = wpex_option('blog_cats_exclude');
     // Admin option is blank, so bail.
     if ($cats_to_exclude == '') {
         return;
     }
     // Blog template
     if (is_home() && !is_singular('page')) {
         $exclude = $cats_to_exclude;
     } else {
         return;
         // Do nothing, ok?
     }
     if ($cats_to_exclude) {
         set_query_var('category__not_in', $cats_to_exclude);
     }
 }
Ejemplo n.º 20
0
function MyBreadcrumb()
{
    if (!is_home()) {
        echo '<li><a href="';
        echo get_option('home');
        echo '/">';
        echo 'Home';
        echo '</a><span class="divider">/</span></li>';
        if (is_category() || is_single()) {
            echo '<li>';
            the_category(', ', '&title_li=');
            echo '<span class="divider">/</span></li>';
            echo '</li>';
            if (is_single()) {
                echo '<li class="active">';
                // the_title();
                echo '</li>';
            }
        } elseif (is_page()) {
            echo '<li class="active">';
            the_title();
            echo '</li>';
        }
    }
}
Ejemplo n.º 21
0
function custom_body_class()
{
    $options = get_desing_plus_option();
    echo ' class="';
    if (!is_page() && is_home()) {
        echo ' index';
    }
    if ($options['header_layout'] == 'fixed') {
        echo ' fixed_header';
    }
    if ($options['layout'] == 'right') {
        echo ' layout1';
    } elseif ($options['layout'] == 'left') {
        echo ' layout2';
    } else {
        echo ' three_column';
    }
    if ($options['layout'] == 'three_column1') {
        echo ' layout3';
    } elseif ($options['layout'] == 'three_column2') {
        echo ' layout4';
    }
    if (is_page_template('page-noside.php')) {
        echo ' no_side';
    }
    echo ' custom-background"';
}
function my_get_posts($query)
{
    if (is_home() && $query->is_main_query()) {
        $query->set('post_type', array('post', 'screenshot', 'trailer'));
    }
    return $query;
}
Ejemplo n.º 23
0
/**
 * Wp in Progress
 * 
 * @author WPinProgress
 *
 * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
 * It is also available at this URL: http://www.gnu.org/licenses/gpl-3.0.txt
 */
function novalite_get_title()
{
    global $post;
    $title = get_the_title();
    if (!empty($title)) {
        if (is_home() || is_category() || is_search()) {
            ?>
				
			<h3 class="title"> <a href="<?php 
            echo get_permalink($post->ID);
            ?>
"> <?php 
            echo $title;
            ?>
 </a> </h3>
				
	<?php 
        } else {
            ?>
			
			<h1 class="title"> <?php 
            echo $title;
            ?>
 </h1>
			
	<?php 
        }
    }
}
Ejemplo n.º 24
0
 /**
  * Check for an archive-{post-type} situation.
  *
  * @param string $postType The post type to check for
  * @param array $details Settings for the route
  */
 private static function archive($postType, array $details)
 {
     if ((is_post_type_archive($postType) || is_home()) && !is_search()) {
         self::loadController($details);
         exit;
     }
 }
Ejemplo n.º 25
0
function baw_hack_wp_title_for_home($title)
{
    if (empty($title) && (is_home() || is_front_page())) {
        return __('Home', 'theme_domain');
    }
    return $title;
}
 /**
  * get the current page ID.
  *
  * @return  int the current page ID.
  */
 public function page_id()
 {
     global $post;
     if (isset($post)) {
         /**
          * Get the current post ID
          */
         $id = $post->ID;
         /**
          * If we're on the posts page, get the ID of the page
          * using the 'page_for_posts' option.
          */
         if (is_home()) {
             $id = get_option('page_for_posts');
         } else {
             /**
              * I we're on the WooCommerce shop page, get the ID of the page
              * using the 'woocommerce_shop_page_id' option
              */
             if (function_exists('is_shop') && is_shop()) {
                 $id = get_option('woocommerce_shop_page_id');
             } else {
                 /**
                  * If this is a  singular page/post then set ID to the page ID.
                  * If not, then set it to false.
                  */
                 $id = is_singular() ? $post->ID : false;
             }
         }
     } else {
         $id = false;
     }
     return $id;
 }
Ejemplo n.º 27
0
 /**
  * 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' => ''));
     }
 }
Ejemplo n.º 28
0
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);
}
Ejemplo n.º 29
0
/**
 * Page titles
 */
function stachestack_title()
{
    if (is_home()) {
        if (get_option('page_for_posts', true)) {
            $title = get_the_title(get_option('page_for_posts', true));
        } else {
            $title = __('Latest Posts', 'stachestack');
        }
    } elseif (is_archive()) {
        $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
        if ($term) {
            $title = apply_filters('single_term_title', $term->name);
        } elseif (is_post_type_archive()) {
            $title = apply_filters('the_title', get_queried_object()->labels->name);
        } elseif (is_day()) {
            $title = sprintf(__('Daily Archives: %s', 'stachestack'), get_the_date());
        } elseif (is_month()) {
            $title = sprintf(__('Monthly Archives: %s', 'stachestack'), get_the_date('F Y'));
        } elseif (is_year()) {
            $title = sprintf(__('Yearly Archives: %s', 'stachestack'), get_the_date('Y'));
        } elseif (is_author()) {
            $title = sprintf(__('Author Archives: %s', 'stachestack'), get_queried_object()->display_name);
        } else {
            $title = single_cat_title('', false);
        }
    } elseif (is_search()) {
        $title = sprintf(__('Search Results for %s', 'stachestack'), get_search_query());
    } elseif (is_404()) {
        $title = __('Not Found', 'stachestack');
    } else {
        $title = get_the_title();
    }
    return apply_filters('stachestack_title', $title);
}
Ejemplo n.º 30
-9
/**
 * Add breadcrumbs functionality to your WordPress theme
 *
 * Once you have included the function in your functions.php file
 * you can then place the following anywhere in your theme templates
 * if(function_exists('bootstrap_breadcrumbs')) bootstrap_breadcrumbs();
 *
 * credit to: c.bavota - http://bavotasan.com (thanks for the code start)
 */
function bootstrap_breadcrumbs()
{
    echo '<ol class="breadcrumb">';
    echo '<li><a href="' . home_url('/') . '">Home</a></li>';
    // are we at "blog home"?
    if (is_home()) {
        echo '<li><a href="#">Blogs</a></li>';
    }
    // where else do we want breadcrumbs
    if (!is_page_template('pt-home.php') && !is_home()) {
        // check if we're in a commerce plugin
        if (function_exists('is_woocommerce') && is_woocommerce()) {
            echo '<li><a href="/publications/order/">Shop</a></li>';
            $product_cats = wp_get_post_terms(get_the_ID(), 'product_cat');
            echo '<li><a href="/publications/order/' . str_replace(" ", "-", $product_cats[0]->name) . '">' . $product_cats[0]->name . '</a></li>';
        }
        // breadcrumb wordpress structures
        if (is_category() || is_single() || is_single('aof')) {
            if (get_the_category()) {
                $category = get_the_category();
                echo '<li><a href="/blog/category/' . str_replace(" ", "-", $category[0]->cat_name) . '">' . $category[0]->cat_name . '</a></li>';
            }
            if (is_single()) {
                echo '<li class="active">';
                the_title();
                echo '</li>';
            }
        } elseif (is_page()) {
            echo '<li class="active">';
            the_title();
            echo '</li>';
        }
    }
    echo '</ol>';
}