public static function blog_style_recent_posts_widget_loop($args = array()) { ?> <div id="post-<?php the_ID(); ?> " <?php post_class(); ?> > <div class="post-aside"> <p class="post-date"><?php the_time('M'); ?> <br /><?php the_time('j'); ?> </p> <p class="author">By <?php the_author_posts_link(); ?> </p> </div> <div class="post-content"> <?php $post_title = get_the_title(); ?> <?php if (!empty($post_title)) { ?> <h2 class="entry-title"><a href="<?php the_permalink(); ?> " rel="bookmark"><?php the_title(); ?> </a></h2> <?php } else { ?> <h2 class="entry-title"><a href="<?php the_permalink(); ?> " rel="bookmark">(no title)</a></h2> <?php } ?> <div class="post-meta"> <?php PC_Hooks::pc_post_meta(); /* Framework hook wrapper */ ?> <p> <span class="categories">Category: <?php the_category(', '); ?> </span> <?php the_tags('<span class="tags">Tags: ', ', ', '</span>'); ?> <?php if (comments_open()) { ?> <span class="comments"><a href="<?php the_permalink(); ?> #comments" title="<?php the_title_attribute(); ?> "><?php comments_number('Leave a Comment', '1 Comment', '% Comments'); ?> </a></span> <?php } ?> </p> </div><!-- .post-meta --> <?php if ($args['spt']) { ?> <?php if (has_post_thumbnail()) { ?> <div class="post-thumb"> <?php $post_id = get_the_ID(); echo PC_Utility::get_responsive_slider_image($post_id, 'post-thumbnail'); /* Show post thumbnail image, if one exists. */ ?> </div> <!-- .post-thumb --> <?php } ?> <?php } ?> <?php global $more; $more = 0; the_content(' ' . $args['read_more']); wp_link_pages(array('before' => '<div class="page-link">', 'after' => '</div>')); ?> </div> <!-- .post-content --> </div> <!-- .post --> <?php }
?> </a></h2> <?php } else { ?> <h2 class="entry-title"><a href="<?php the_permalink(); ?> " rel="bookmark">(no title)</a></h2> <?php } ?> <div class="post-meta"> <?php PC_Hooks::pc_post_meta(); /* Framework hook wrapper */ ?> <p> <span class="categories">Category: <?php the_category(', '); ?> </span> <?php the_tags('<span class="tags">Tags: ', ', ', '</span>'); ?> <?php global $post; ?>
<?php PC_Hooks::pc_after_opening_footer_tag(); /* Framework hook wrapper */ ?> <?php get_sidebar('footer'); // Adds support for the four footer widget areas ?> <?php PC_Hooks::pc_before_closing_footer_tag(); /* Framework hook wrapper */ ?> </footer> </div><!-- #body-container --> <?php PC_Hooks::pc_after_closing_footer_tag(); /* Framework hook wrapper */ wp_footer(); ?> </body> </html>
<span class="comments"><a href="<?php the_permalink(); ?> #comments" title="<?php the_title_attribute(); ?> "><?php comments_number('Leave a Comment', '1 Comment', '% Comments'); ?> </a></span> <?php } ?> </p> <?php PC_Hooks::pc_after_post_meta(); /* Framework hook wrapper */ ?> </div><!-- .post-meta --> <?php if (wp_attachment_is_image(get_the_ID())) { $att_image = wp_get_attachment_image_src(get_the_ID(), "medium"); ?> <p class="attachment"><a href="<?php echo wp_get_attachment_url(get_the_ID()); ?> " title="<?php the_title(); ?> " rel="attachment"><img src="<?php
/* Framework hook wrapper */ ?> <div class="<?php echo PC_Utility::content_layout_classes_primary(); ?> "> <?php PC_Hooks::pc_after_content_open(); /* Framework hook wrapper */ ?> <?php get_template_part('loop', 'blog-page'); /* Framework standard loop. */ ?> </div><!-- .content --> <?php PC_Hooks::pc_after_content(); /* Framework hook wrapper */ ?> </div><!-- #contentwrap --> </div><!-- #container --> <?php get_footer();
echo PC_OPTIONS_DB_NAME; ?> [chk_show_social_buttons]" type="checkbox" value="1" class="alignleft" <?php if (isset($options['chk_show_social_buttons'])) { checked('1', $options['chk_show_social_buttons']); } ?> /><?php _e('Show Twitter/Facebook Buttons?', 'presscoders'); ?> </label> </div> <?php /* Add theme specific misc options via this hook. */ PC_Hooks::pc_set_theme_option_fields_misc(); /* Framework hook wrapper */ ?> </div><!-- .rtoptions --> </div><!-- .tabcontent --> <!-- "General Settings" tab --> <div class="tabcontent"> <div class="ltinfo"> <img src="<?php echo PC_THEME_ROOT_URI . '/api/images/icons/sprocket-32.png'; ?> " width="32" height="32" class="optionsicon" />
<?php PC_Hooks::pc_before_head(); /* Framework hook wrapper */ ?> <head> <meta charset="utf-8" /> <!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame --> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <?php PC_Hooks::pc_head_top(); /* Framework hook wrapper */ ?> <meta name="viewport" content="width=device-width"> <link rel="stylesheet" href="<?php echo get_stylesheet_uri(); ?> " type="text/css" media="screen" /> <?php wp_head(); ?> </head> <body <?php body_class(PC_THEME_NAME_SLUG); ?> >
/** * Set default theme options. * * This function updates the theme options with the specified defaults ONLY if they don't exist. The * idea being that new theme options can be added by a developer and picked up by the theme without having * to blank the existing theme options first. If some options exist then merge current options with defaults * to set any new theme options that may have been added since last theme activation. This method does NOT * overwrite any theme options if they already exist. * * Important: Any checkboxes you need to be ON by default just add them to an array, in addition to the * $pc_default_options array, but with a "0" value. Otherwise when the theme is deactivated/reactivated the ON by * default checkboxes will always be set to ON even if the user set to off in the meantime. This is because if * a check box is turned off it is not stored in the options db at all, but to be efectively tested by the * array_merge($pc_default_options, $current_options) function, if it has been turned off by the user then it * needs to be set to zero manually in the code. * * @since 0.1.0 */ public function default_theme_options() { /* Define as global to accessible anywhere (i.e. from within hook callbacks). */ global $pc_default_options, $pc_footer_links; /* Define some theme specific option constants. */ define("PC_ADMIN_EMAIL_TEXTBOX", "txt_admin_email"); define("PC_SEO_SETTINGS_CHECKBOX", "chk_seo_settings"); define("PC_DEFAULT_LAYOUT_THEME_OPTION", "drp_default_layout"); define("PC_LOGO_URL_OPTION_NAME", "txt_logo_url"); // logo url text box define("PC_LOGO_CHK_OPTION_NAME", "chk_custom_logo"); // logo checkbox (to use/not use a custom logo) /* @todo Add footer links in via a (theme specific) hook cb only if the footer theme options are used. */ $footer_theme_name = PC_THEME_NAME == 'Designfolio Pro' ? 'designfolio' : PC_THEME_NAME; $pc_footer_links = '<div id="site-info"><p class="copyright">© [year] [site-url]</p><p class="pc-link">Powered by <a href="http://wordpress.org/" target="_blank" class="wp-link">WordPress</a> and the <a href="http://www.presscoders.com/' . $footer_theme_name . '/" target="blank" title="' . PC_THEME_NAME . ' WordPress Theme">' . PC_THEME_NAME . ' Theme</a>.</p></div><!-- #site-info -->'; /* Defaults options array. */ $pc_default_options = array(PC_LOGO_CHK_OPTION_NAME => null, PC_LOGO_URL_OPTION_NAME => "", "chk_hide_description" => null, PC_DEFAULT_LAYOUT_THEME_OPTION => "2-col-r", "chk_show_social_buttons" => "1", PC_SEO_SETTINGS_CHECKBOX => null, PC_ADMIN_EMAIL_TEXTBOX => get_bloginfo('admin_email'), "txtarea_header" => "", "txtarea_footer" => "", "txtarea_footer_links" => $pc_footer_links, "txt_favicon" => "", "txtarea_custom_css" => ""); /* Get a copy of the current theme options. */ $current_options = get_option(PC_OPTIONS_DB_NAME); /* If theme options not set yet then don't bother trying to merge with the $pc_default_off_checkboxes. */ if (is_array($current_options)) { /* Define as global to accessible anywhere (i.e. from within hook callbacks). */ global $pc_default_off_checkboxes; $pc_default_off_checkboxes = array("chk_show_social_buttons" => "0"); } /* Add theme specific default settings vis this hook. */ PC_Hooks::pc_theme_option_defaults(); /* Framework hook wrapper */ /* Added this here rather inside the same 'if' statement above so we can add extra $pc_default_off_checkboxes via a hook. */ if (is_array($current_options)) { /* Manually set the checkboxes that have been unchecked, by the user, to zero. */ $current_options = array_merge($pc_default_off_checkboxes, $current_options); } /* If there are no existing options just use defaults (no merge). */ if (!$current_options || empty($current_options)) { // Update options in db update_option(PC_OPTIONS_DB_NAME, $pc_default_options); } else { /* Merge current options with the defaults, i.e. add any new options but don't overwrite existing ones. */ $result = array_merge($pc_default_options, $current_options); /* Update options in db. */ update_option(PC_OPTIONS_DB_NAME, $result); } }
/** * Loop through the specified custom theme template files. * * @since 0.1.0 */ public static function custom_widget_area_loop($sidebar_hook = '', $fallback_default_widget_area_name = '', $fallback_default_file = '', $show_default = false, $default_file = '', $check_global = false) { global $pc_template; /* Default to post widget area if nothing else specified. */ if (empty($fallback_default_file)) { $fallback_default_file = 'primary_post_generic_default_widgets.php'; } if (empty($fallback_default_widget_area_name)) { $fallback_default_widget_area_name = 'primary-post-widget-area'; } $custom_pages = array(); /* Initialize to empty array. */ /* At the moment this feature only supports (i.e. was only needed for) primary sidebars, but it can be easily extended for secondary sidebars. */ switch ($sidebar_hook) { case 'primary-archive': $custom_pages = PC_Hooks::pc_custom_primary_sidebar_archive($custom_pages); /* Framework hook wrapper */ break; case 'primary-pages': $custom_pages = PC_Hooks::pc_custom_primary_sidebar_pages($custom_pages); /* Framework hook wrapper */ break; case 'primary-posts': $custom_pages = PC_Hooks::pc_custom_primary_sidebar_posts($custom_pages); /* Framework hook wrapper */ break; default: $custom_pages = array(); } $custom_pages_flag = 0; foreach ($custom_pages as $custom_page => $widget_area) { if ($pc_template == $custom_page) { self::render_widget_area($widget_area, $show_default, $default_file, $check_global); $custom_pages_flag = 1; break; } } /* If no custom pages set then show a default widget area. */ if ($custom_pages_flag == 0) { self::render_widget_area($fallback_default_widget_area_name, true, $fallback_default_file, true); } }
/** * Search page loop template part. * * Used in theme search.php template file. * * @since 0.1.0 */ public static function search_page_loop($s) { ?> <?php if (have_posts()) { ?> <h2 class="entry-title"><?php _e('Search results...', 'presscoders'); ?> </h2> <?php while (have_posts()) { the_post(); ?> <?php // Code to show search terms highlighted $keys = explode(" ", $s); $title = get_the_title(); $content = PC_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); ?> <div id="post-<?php the_ID(); ?> " <?php post_class(); ?> > <h2 class="entry-title"><a href="<?php the_permalink(); ?> " rel="bookmark"><?php echo $title; ?> </a></h2> <?php echo $content; ?> <div class="post-meta"> <?php PC_Hooks::pc_post_meta(); /* Framework hook wrapper */ ?> <p> <span class="date"><?php the_time('M j, Y'); ?> </span> <span class="categories"><?php the_category(', '); ?> </span> <?php if (comments_open()) { ?> <span class="comments"><a href="<?php the_permalink(); ?> #comments" title="<?php the_title_attribute(); ?> "><?php comments_number('Leave a Comment', '1 Comment', '% Comments'); ?> </a></span> <?php } ?> </p> </div><!-- .post-meta --> </div> <!-- post-item --> <?php } // end of the loop. ?> <?php } else { ?> <div id="post-0" class="post no-results not-found"> <h2 class="entry-title"><?php _e('No search results found...', 'presscoders'); ?> </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.', 'presscoders'); ?> </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', 'presscoders'); ?> </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', 'presscoders'); ?> </h3> <ul> <?php //wp_list_cats(); wp_list_categories(); ?> </ul> </div> </div><!-- #post-0 --> <?php } ?> <?php }