Exemplo n.º 1
0
    /**
     * Search page loop template part.
     *
     * Used in theme search.php template file.
     *
     * @since 0.1.0
     */
    public function search_page_loop($s, $args = array())
    {
        global $wp_query;
        // used to access total number of search results
        $args = extract($this->merge_loop_arguments($args));
        $date_sep = '';
        $total_results = $wp_query->found_posts;
        ?>

		<?php 
        if (have_posts()) {
            ?>

			<h2 id="search-results-header" class="entry-title"><?php 
            _e('Search results for', 'wpgothemes');
            echo ' \'' . $s . '\'';
            ?>
</h2>
			<div id="search-matches"><?php 
            printf(_n('%d match found', '%d matches found', $total_results, 'wpgothemes'), $total_results);
            ?>
</div>

			<hr id="search-hr">

			<?php 
            while (have_posts()) {
                the_post();
                ?>

				<?php 
                // Code to show search terms highlighted
                $keys = explode(" ", $s);
                $title = get_the_title();
                $content = WPGo_Utility::n_words(wp_strip_all_tags(get_the_content()), 300);
                $title = preg_replace('/(' . implode('|', $keys) . ')/iu', '<span class="search-results">\\0</span>', $title);
                $content = preg_replace('/(' . implode('|', $keys) . ')/iu', '<span class="search-results">\\0</span>', $content);
                ?>

				<article id="post-<?php 
                the_ID();
                ?>
" <?php 
                post_class();
                ?>
>

					<header>

						<?php 
                $no_title = __('(no title)', 'wpgothemes');
                ?>

						<?php 
                WPGo_Utility::check_empty_post_title(get_the_ID(), 'h3', $no_title, 'search-loop-header');
                ?>

						<?php 
                if ($render_date) {
                    ?>
							<div class="post-meta post-meta-inline">
								<?php 
                    WPGo_Hooks::wpgo_post_archive_meta_header();
                    ?>
								<?php 
                    if ($render_date) {
                        ?>
									<time class="date" datetime="<?php 
                        the_date('c');
                        ?>
" pubdate><?php 
                        the_time(get_option('date_format'));
                        ?>
</time><?php 
                        echo $date_sep;
                    }
                    ?>
							</div><!-- .post-meta -->
						<?php 
                }
                ?>

					</header>

					<?php 
                WPGo_Hooks::wpgo_before_post_archive_content();
                ?>

					<div class="post-content">
						<?php 
                echo $content;
                ?>
						<?php 
                wp_link_pages(array('before' => '<div class="page-link">', 'after' => '</div>'));
                ?>
					</div>
					<!-- .post-content -->

				</article> <!-- .post -->

			<?php 
            }
            // end of the loop.
            ?>

			<?php 
            WPGo_Utility::paginate_links();
            ?>

		<?php 
        } else {
            ?>

			<div id="post-0" class="post no-results not-found">

				<h2 class="entry-title"><?php 
            _e('No search results found...', 'wpgothemes');
            ?>
</h2>

				<p><?php 
            _e('Sorry, but nothing matched your search criteria. Please try again with some different keywords. Or, choose from the links below to navigate to another page.', 'wpgothemes');
            ?>
</p>

				<div style="margin:0 auto;width:300px;"><?php 
            get_search_form();
            ?>
</div>

				<div class="widget" style="width:260px;float:left;">
					<h3 class="widget-title"><?php 
            _e('Pages', 'wpgothemes');
            ?>
</h3>
					<ul>
						<?php 
            wp_list_pages('title_li=');
            ?>
					</ul>
				</div>

				<div class="widget" style="width:260px;float:right;">
					<h3 class="widget-title"><?php 
            _e('Post Categories', 'wpgothemes');
            ?>
</h3>
					<ul>
						<?php 
            //wp_list_cats();
            wp_list_categories();
            ?>
					</ul>
				</div>

			</div><!-- #post-0 -->

		<?php 
        }
        ?>

	<?php 
    }
Exemplo n.º 2
0
<aside id="primary-sidebar" class="sidebar-container" role="complementary">

	<?php 
/* If the page is singular we'll have a valid post/page ID to check for custom widget areas. */
$primary_custom_widget_areas = is_singular() ? get_post_meta($wpgo_post_id, '_wpgo_sm_primary_sort', true) : null;
/* Update custom widget array. For any custom widget area specified in post meta not found then delete post meta reference to it. */
$primary_custom_widget_areas = WPGo_Utility::check_cwa_exist($primary_custom_widget_areas, $wpgo_post_id, '_wpgo_sm_primary_sort');
/* FRONT PAGE SIDEBARS. */
if ($wpgo_is_front_page && $wpgo_show_on_front == 'posts' || $wpgo_home_page && $wpgo_page_on_front == 0) {
    /* If 'Your latest posts' OR 'A static page' set in Settings -> Reading (and 'Front page' drop down blank) show default post widget area. */
    WPGo_Utility::render_widget_area('primary-post-widget-area', true, true);
} elseif (is_archive()) {
    /* Check for specific archive pages via filter hook. */
    WPGo_Utility::custom_widget_area_loop('primary-archive');
} elseif (is_singular()) {
    if (!empty($primary_custom_widget_areas)) {
        WPGo_Utility::render_custom_widget_areas($primary_custom_widget_areas);
    } elseif (is_single()) {
        /* Check for custom posts type pages via filter hook. */
        WPGo_Utility::custom_widget_area_loop('primary-posts', 'primary-post-widget-area', 'primary_post_generic_default_widgets.php', true);
    } elseif (is_page()) {
        /* Check for custom pages via filter hook. */
        WPGo_Utility::custom_widget_area_loop('primary-pages', 'primary-page-widget-area', 'primary_page_generic_default_widgets.php', true);
    }
} else {
    /* Catch all case. Show primary post widget area. */
    WPGo_Utility::render_widget_area('primary-post-widget-area', true, true);
}
?>

</aside><!-- .sidebar-container -->
Exemplo n.º 3
0
    /**
     * Display theme options page.
     *
     * @since 0.1.0
     */
    public function render_theme_form()
    {
        ?>
		<div class="wrap">
			<h2><?php 
        printf(__('%s Theme Support', 'wpgothemes'), WPGO_THEME_NAME);
        ?>
</h2>

			<?php 
        // Check to see if user clicked on the reset options button
        if (isset($_POST['reset_options'])) {
            // Access theme defaults
            global $wpgo_default_options;
            // Reset theme defaults
            update_option(WPGO_OPTIONS_DB_NAME, $wpgo_default_options);
            // Display update notice here
            ?>
				<div class="error">
				<p><?php 
            printf(__('%s theme options have been reset!', 'wpgothemes'), WPGO_THEME_NAME);
            ?>
</p>
				</div><?php 
            $this->wpgo_fadeout_element('.error');
            // fadeout .updated class
        }
        // Display update notice if theme options reset
        if (isset($_GET['settings-updated']) && !isset($_POST['reset_options'])) {
            ?>
				<div class="updated">
				<p><?php 
            printf(__('%s theme options updated!', 'wpgothemes'), WPGO_THEME_NAME);
            ?>
</p></div><?php 
            $this->wpgo_fadeout_element();
            // fadeout .updated class
        }
        ?>

			<!-- Start Main Form -->
			<form method="post" action="options.php">
				<?php 
        settings_fields(WPGO_THEME_OPTIONS_GROUP);
        do_settings_sections(WPGO_THEME_MENU_SLUG);
        submit_button();
        ?>
			</form>
			<!-- main form closing tag -->

			<form action="<?php 
        echo WPGo_Utility::currURL();
        // current page url
        ?>
" method="post" id="wpgo-theme-options-reset" style="display:inline;">
				<span class="submit-theme_options-reset">
					<input type="submit" onclick="return confirm('Are you sure? All theme options will be reset to their default settings!');" value="Reset <?php 
        echo WPGO_THEME_NAME;
        ?>
 Options" name="wpgo_reset" class="wpgo-reset-link">
					<input type="hidden" name="reset_options" value="true">
				</span>
			</form>
		</div><!-- .wrap -->
	<?php 
    }
Exemplo n.º 4
0
	<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame -->
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

	<?php 
WPGo_Hooks::wpgo_head_top();
?>

	<meta name="viewport" content="width=device-width, initial-scale=1" />

	<?php 
wp_head();
?>
</head>

<body <?php 
body_class(WPGo_Utility::theme_classes());
?>
>

<div id="body-container">

	<div id="header-container">

		<header>
			<?php 
if (current_theme_supports('wpgo-custom-menus') && has_nav_menu(WPGO_CUSTOM_NAV_MENU_2)) {
    ?>
				<nav class="secondary-menu">
					<?php 
    $args = array('theme_location' => WPGO_CUSTOM_NAV_MENU_2);
    wp_nav_menu($args);
 /**
  * Validate color picker hex values.
  *
  * Only run on the customizer. If any color scheme hex value is only 3-digits or contains an uppercase character
  * it can cause issues when changing color schemes. This function makes sure the hex value is 6-digits and contains
  * only lowercase characters.
  *
  * @since 0.2.0
  */
 public function validate_color_scheme_hex_codes()
 {
     /* Exit if not on the Customizer. */
     if (!WPGo_Utility::is_customizer()) {
         return;
     }
     foreach ($this->_wpgo_color_schemes as $cs_index => $color_scheme) {
         foreach ($color_scheme['default_colors'] as $col_index => $default_colors) {
             $dc = $default_colors;
             // so we can change it's value
             if (strlen($dc) == 4) {
                 $dc = $dc[0] . $dc[1] . $dc[1] . $dc[2] . $dc[2] . $dc[3] . $dc[3];
             }
             $this->_wpgo_color_schemes[$cs_index]['default_colors'][$col_index] = strtolower($dc);
         }
     }
 }
global $wpgo_is_front_page, $wpgo_home_page, $wpgo_show_on_front, $wpgo_page_on_front, $wpgo_post_id, $wpgo_template, $wp_registered_sidebars;
?>

<aside id="secondary-sidebar" class="sidebar-container" role="complementary">

	<?php 
/* If the page is singular we'll have a valid post/page ID to check for custom widget areas. */
$secondary_custom_widget_areas = is_singular() ? get_post_meta($wpgo_post_id, '_wpgo_sm_secondary_sort', true) : null;
/* Update custom widget array. For any custom widget area specified in post meta not found then delete post meta reference to it. */
$secondary_custom_widget_areas = WPGo_Utility::check_cwa_exist($secondary_custom_widget_areas, $wpgo_post_id, '_wpgo_sm_secondary_sort');
/* FRONT PAGE SIDEBARS. */
if ($wpgo_is_front_page && $wpgo_show_on_front == 'posts' || $wpgo_home_page && $wpgo_page_on_front == 0) {
    /* If 'Your latest posts' OR 'A static page'  set in Settings -> Reading (and 'Front page' drop down blank) show default post widget area. */
    WPGo_Utility::render_widget_area('secondary-post-widget-area', true, false);
} elseif (is_archive()) {
    WPGo_Utility::render_widget_area('secondary-post-widget-area', true, false);
} elseif (is_singular()) {
    if (!empty($secondary_custom_widget_areas)) {
        WPGo_Utility::render_custom_widget_areas($secondary_custom_widget_areas);
    } elseif (is_single()) {
        WPGo_Utility::render_widget_area('secondary-post-widget-area', true, false);
    } elseif (is_page()) {
        WPGo_Utility::render_widget_area('secondary-page-widget-area', true, false);
    }
} else {
    /* Catch all case. Show secondary post widget area. */
    WPGo_Utility::render_widget_area('secondary-post-widget-area', true, false);
}
?>

</aside><!-- .sidebar-container -->
 /**
  * Enqueue Dashicons on the front end if user not logged in.
  *
  * From WordPress 3.8 the Dashicons font is automatically enqueued on front end when user is logged in. However,
  * we still need this to be enqueued when not logged in.
  *
  * @since 0.2.0
  */
 public function enqueue_dashicons_font()
 {
     // enqueue if user NOT logged in, or logged in and we're on the theme customizer
     if (is_user_logged_in() && !WPGo_Utility::is_customizer()) {
         return;
     }
     // Dashicons
     $suffix = SCRIPT_DEBUG ? '' : '.min';
     wp_register_style('wpgo-dashicons', "/wp-includes/css/dashicons{$suffix}.css");
     wp_enqueue_style('wpgo-dashicons');
 }