/** * Renders the sidebar after content div. * * @since 0.1.0 */ public function sidebar_after() { PC_Utility::render_sidebar_after(PC_DEFAULT_LAYOUT_THEME_OPTION); }
PC_Hooks::pc_after_container(); /* Framework hook wrapper */ ?> <div id="contentwrap" <?php echo PC_Utility::contentwrap_layout_classes(); ?> > <?php PC_Hooks::pc_before_content(); /* 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 -->
/** * Add theme specific content to the header. * * @since 0.1.0 */ public function pc_ts_custom_wp_head() { ?> <!--[if IE 8]> <style type="text/css"> .comment-body, li.pingback, .quote, .avatar, .defaultbtn, .button, .btn, #searchsubmit, #submit, .submit, .post-edit-link, .more-link, input[type="submit"], input[type="text"], textarea, ol.flex-control-nav li a, ol.flex-control-nav li a.active, .flex-direction-nav li a, .post-date, nav.secondary-menu, nav ul ul { behavior: url(<?php echo PC_Utility::theme_resource_uri('includes/js', 'PIE.htc'); ?> ); } </style> <![endif]--> <?php }
?> " onclick="show_confirm_fl()" /> </div><!-- .rtoptions --> </div><!-- .tabcontent --> </div> </div><!-- #bluetabs --> <span class="submit"><input type="submit" class="button-primary" value="<?php _e('Save Changes', 'presscoders'); ?> " /></span> </form> <!-- main form closing tag --> <form action="<?php echo PC_Utility::currURL(); // current page url ?> " method="post" id="pc-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!');" class="button submit-button reset-button" value="Reset <?php echo PC_THEME_NAME; ?> Options" name="pc_reset"> <input type="hidden" name="reset_options" value="true"> </span> </form> </div><!-- .wrap pc_settings -->
?> <div id="secondary-sidebar" class="sidebar-container <?php echo PC_Utility::content_layout_classes_secondary(true); ?> " 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($pc_post_id, '_' . PC_THEME_NAME_SLUG . '_secondary_sort', true) : null; /* FRONT PAGE SIDEBARS. */ if ($pc_is_front_page && $pc_show_on_front == 'posts' || $pc_home_page && $pc_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. */ PC_Utility::render_widget_area('secondary-post-widget-area', true, 'secondary_post_generic_default_widgets.php', false); } elseif (is_archive()) { PC_Utility::render_widget_area('secondary-post-widget-area', true, 'secondary_post_generic_default_widgets.php', false); } elseif (is_singular()) { if (!empty($secondary_custom_widget_areas)) { PC_Utility::render_custom_widget_areas($secondary_custom_widget_areas); } elseif (is_single()) { PC_Utility::render_widget_area('secondary-post-widget-area', true, 'secondary_post_generic_default_widgets.php', false); } elseif (is_page()) { PC_Utility::render_widget_area('secondary-page-widget-area', true, 'secondary_page_generic_default_widgets.php', false); } } else { /* Catch all case. Show secondary post widget area. */ PC_Utility::render_widget_area('secondary-post-widget-area', true, 'secondary_post_generic_default_widgets.php', false); } ?> </div><!-- .sidebar-container -->
function widget($args, $instance) { extract($args); echo $before_widget; $title = $instance['title']; $info_description = $instance['info_description']; $phone_number = $instance['phone_number']; $twitter_id = $instance['twitter_id']; $facebook_id = $instance['facebook_id']; $rss_id = $instance['rss_id']; $youtube_id = $instance['youtube_id']; $googleplus_id = $instance['googleplus_id']; $linkedin_id = $instance['linkedin_id']; $flickr_id = $instance['flickr_id']; $pinterest_id = $instance['pinterest_id']; $custom_id_1 = $instance['custom_id_1']; $custom_img_1 = $instance['custom_img_1']; if (!empty($title)) { echo $before_title . $title . $after_title; } if (!empty($info_description)) { echo '<span class="info_description">' . $info_description . '</span>'; } if (!empty($phone_number)) { echo '<span class="phone"><a href="tel:' . $phone_number . '">' . $phone_number . '</a></span>'; } /* Icons that need only an ID specified. */ if (!empty($facebook_id)) { echo '<a href="http://www.facebook.com/' . $facebook_id . '" target="_blank" class="sm-icon"><img src="' . PC_Utility::theme_resource_uri(array('images/', 'api/images/icons/'), 'facebook.png', 'images/') . '" width="32" height="32" alt="Facebook" /></a>'; } if (!empty($twitter_id)) { echo '<a href="http://twitter.com/' . $twitter_id . '" target="_blank" class="sm-icon"><img src="' . PC_Utility::theme_resource_uri(array('images/', 'api/images/icons/'), 'twitter.png', 'images/') . '" width="32" height="32" alt="Twitter" /></a>'; } if (!empty($youtube_id)) { echo '<a href="http://www.youtube.com/user/' . $youtube_id . '" target="_blank" class="sm-icon"><img src="' . PC_Utility::theme_resource_uri(array('images/', 'api/images/icons/'), 'youtube.png', 'images/') . '" width="32" height="32" alt="YouTube" /></a>'; } if (!empty($flickr_id)) { echo '<a href="http://www.flickr.com/photos/' . $flickr_id . '" target="_blank" class="sm-icon"><img src="' . PC_Utility::theme_resource_uri(array('images/', 'api/images/icons/'), 'flickr.png', 'images/') . '" width="32" height="32" alt="Flickr" /></a>'; } if (!empty($pinterest_id)) { echo '<a href="http://pinterest.com/' . $pinterest_id . '" target="_blank" class="sm-icon"><img src="' . PC_Utility::theme_resource_uri(array('images/', 'api/images/icons/'), 'pinterest.png', 'images/') . '" width="32" height="32" alt="Pinterest" /></a>'; } /* Icons that need a full URL specified. */ if (!empty($googleplus_id)) { echo '<a href="' . $googleplus_id . '" target="_blank" class="sm-icon"><img src="' . PC_Utility::theme_resource_uri(array('images/', 'api/images/icons/'), 'googleplus.png', 'images/') . '" width="32" height="32" alt="Google+" /></a>'; } if (!empty($linkedin_id)) { echo '<a href="' . $linkedin_id . '" target="_blank" class="sm-icon"><img src="' . PC_Utility::theme_resource_uri(array('images/', 'api/images/icons/'), 'linkedin.png', 'images/') . '" width="32" height="32" alt="Linked In" /></a>'; } if (!empty($rss_id)) { echo '<a href="' . $rss_id . '" target="_blank" class="sm-icon"><img src="' . PC_Utility::theme_resource_uri(array('images/', 'api/images/icons/'), 'rss.png', 'images/') . '" width="32" height="32" alt="RSS" /></a>'; } if (!empty($custom_id_1)) { echo '<a href="' . $custom_id_1 . '" target="_blank" class="sm-icon"><img src="' . $custom_img_1 . '" width="32" height="32" alt="Custom Icon 1" /></a>'; } ?> <?php if ($instance['show_search'] == "1") { ?> <div class="search"> <form role="search" method="get" id="searchform" action="<?php echo home_url('/'); ?> " > <span> <input type="text" placeholder="Search…" value="<?php echo get_search_query(); ?> " size="10" name="s" id="s"><input type="submit" id="searchsubmit" value="<?php echo esc_attr__('Search', 'presscoders'); ?> "> </span> </form> </div> <?php } echo $after_widget; }
<?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($pc_post_id, '_' . PC_THEME_NAME_SLUG . '_primary_sort', true) : null; /* Show global widget area if it contains widgets and we are NOT on a post/page that has custom widget areas set. */ if (is_active_sidebar('global-widget-area') && empty($primary_custom_widget_areas)) { PC_Utility::render_widget_area('global-widget-area'); } /* FRONT PAGE SIDEBARS. */ if ($pc_is_front_page && $pc_show_on_front == 'posts' || $pc_home_page && $pc_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. */ PC_Utility::render_widget_area('primary-post-widget-area', true, 'primary_post_generic_default_widgets.php', true); } elseif (is_archive()) { /* Check for specific archive pages via filter hook. */ PC_Utility::custom_widget_area_loop('primary-archive'); } elseif (is_singular()) { if (!empty($primary_custom_widget_areas)) { PC_Utility::render_custom_widget_areas($primary_custom_widget_areas); } elseif (is_single()) { /* Check for custom posts type pages via filter hook. */ PC_Utility::custom_widget_area_loop('primary-posts'); } elseif (is_page()) { /* Check for custom pages via filter hook. */ PC_Utility::custom_widget_area_loop('primary-pages', 'primary-page-widget-area', 'primary_page_generic_default_widgets.php'); } } else { /* Catch all case. Show primary post widget area. */ PC_Utility::render_widget_area('primary-post-widget-area', true, 'primary_post_generic_default_widgets.php', true); } ?> </div><!-- .sidebar-container -->
/** * 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 }
function widget($args, $instance) { extract($args); $delay_speed = $instance['delay_speed']; $transition_speed = $instance['transition_speed']; $number_items = $instance['number_items']; $slider_groups = $instance['slider_groups']; $randomize = $instance['randomize']; $fi_post_link = $instance['fi_post_link']; $autoplay = $instance['autoplay']; $smooth_height = $instance['smooth_height']; $animation_loop = $instance['animation_loop']; $transition_effect = $instance['transition_effect']; /* */ if (empty($slider_groups)) { $slider_groups = ''; } $order = $randomize ? 'rand' : 'date'; $autoplay_slides = $autoplay ? 'true' : 'false'; $smooth_height = $smooth_height ? 'true' : 'false'; $auto_animation_loop = $animation_loop ? 'true' : 'false'; $r = new WP_Query(array('post_type' => 'portfolio', 'orderby' => $order, 'showposts' => $number_items, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'tax_query' => array(array('taxonomy' => 'portfolio_group', 'field' => 'id', 'terms' => $slider_groups)))); if ($r->have_posts()) { // There is at least one post to show global $pc_is_front_page; global $pc_post_id; // need the post id to check for the sidebars per post/page feature global $wp_registered_sidebars; // global widget areas array global $pc_global_column_layout; // *********************************************************** // ** DETERMINE WIDGET AREA LOCATION AND WIDTH TYPE ** // *********************************************************** $widget_area = null; $sidebars_widgets = wp_get_sidebars_widgets(); // Try to get the widget area the widget belongs to foreach ($sidebars_widgets as $sidebar => $widgets) { if ('wp_inactive_widgets' == $sidebar) { continue; } // Ignore inactive widgets if (is_array($widgets)) { if (in_array($this->id, $widgets)) { $widget_area = $sidebar; } } } // If widget instance exists in a widget area if ($widget_area) { // find the widget area width if (isset($wp_registered_sidebars[$widget_area]['width'])) { $widget_area_width = $wp_registered_sidebars[$widget_area]['width']; $width_default = 0; // for debugging } else { $widget_area_width = 'normal'; $width_default = 1; // for debugging } } // ******************************************************* // ** SET THE THUMBNAIL SIZE USED BY THE WIDGET ** // ******************************************************* // add code to enter the correct classname, and slider thumbnail size, depending on the column layout and the widget area width if ($widget_area_width == 'full') { $slider_thumb_size = 'slider_content_full'; } elseif ($widget_area_width == 'wide') { // check page layout to see if the page layout is twothirds, or full width $layout_num = (int) substr($pc_global_column_layout, 0, 1); if ($layout_num == 1) { // full width layout $slider_thumb_size = 'slider_content_full'; } elseif ($layout_num == 2) { // 2 column layout $slider_thumb_size = 'slider_content_twothirds'; } else { // else assume 3 column layout $slider_thumb_size = 'slider_content_third'; } } else { // assume widget area width is 'normal' $slider_thumb_size = 'slider_content_third'; } ?> <?php echo $before_widget; ?> <script type="text/javascript"> jQuery(window).load(function() { jQuery('.flexslider_<?php echo $this->id; ?> ').flexslider({ animation: '<?php echo $transition_effect; ?> ', animationLoop: <?php echo $auto_animation_loop; ?> , pauseOnAction: true, slideshow: <?php echo $autoplay_slides; ?> , pauseOnHover: true, slideshowSpeed: <?php echo $delay_speed; ?> , animationSpeed: <?php echo $transition_speed; ?> , controlsContainer: ".flex-container_<?php echo $this->id; ?> ", smoothHeight: <?php echo $smooth_height; ?> , multipleKeyboard: true, start: function(slider) { <?php // Add any 'start' callback code via a theme specific utility function cb if (method_exists('PC_TS_Utility', 'portfolio_slider_jquery_start_cb')) { echo PC_TS_Utility::portfolio_slider_jquery_start_cb(); } ?> }, before: function(slider) { // Add code here (via theme specific callback function) }, after: function(slider) { // Add code here (via theme specific callback function) } }); }); </script> <div class="flex-container flex-container_<?php echo $this->id; ?> "> <div class="flexslider flexslider_<?php echo $this->id; ?> "> <ul class="slides slides_<?php echo $this->id; ?> "> <?php while ($r->have_posts()) { $r->the_post(); ?> <?php /* Image */ $post_id = get_the_ID(); $featured_image = PC_Utility::get_responsive_slider_image($post_id, $slider_thumb_size); //$show_title = get_post_meta($post_id, '_'.PC_THEME_NAME_SLUG.'_slide_cpt_show_title',true); $title = get_the_title(); //($show_title == 0) ? get_the_title() : null; $portfolio_fi_url = trim(get_post_meta($post_id, '_' . PC_THEME_NAME_SLUG . '_portfolio_cpt_fi_link', true)); $portfolio_title_url = trim(get_post_meta($post_id, '_' . PC_THEME_NAME_SLUG . '_portfolio_cpt_title_link', true)); $post_thumbnail_id = get_post_thumbnail_id($post_id); $featured_image_src_arr = wp_get_attachment_image_src($post_thumbnail_id, 'full'); /* Portfolio featured image link. */ if ($fi_post_link) { /* Override default PF CPT behavior and link FI to post url by default. */ $featured_image_src = get_permalink($post_id); $featured_image = '<a href="' . $featured_image_src . '">' . $featured_image . '</a>'; } else { if (empty($portfolio_fi_url)) { if ($featured_image && is_array($featured_image_src_arr)) { $featured_image_src = $featured_image_src_arr[0]; $featured_image = '<a href="' . $featured_image_src . '">' . $featured_image . '</a>'; } } else { if ($portfolio_fi_url != 'http://none') { $featured_image = '<a href="' . $portfolio_fi_url . '">' . $featured_image . '</a>'; } } } /* Portfolio title link. */ if (empty($portfolio_title_url)) { $pl = get_permalink($post_id); $title = '<a href="' . $pl . '">' . $title . '</a>'; } else { if ($portfolio_title_url != 'http://none') { $title = '<a href="' . $portfolio_title_url . '">' . $title . '</a>'; } } if (!empty($title)) { $title = '<h3 class="portfolio-title">' . $title . '</h3>'; } $content = wpautop(do_shortcode(get_the_content())); ?> <?php /* Allow optional theme specific slider structure to be defined. */ if (method_exists('PC_TS_Utility', 'custom_portfolio_slider_li_structure')) { $args = array('title' => $title, 'featured_image' => $featured_image, 'content' => $content, 'post_id' => $post_id); PC_TS_Utility::custom_portfolio_slider_li_structure($args); /* Otherwise use the default structure. */ } else { ?> <li> <?php echo '<div class="portfolio-slide-content">'; echo $title; //if($show_title == 0) echo $title; if (!empty($featured_image)) { echo $featured_image; } if (!empty($content)) { echo $content; } echo '</div>'; ?> </li> <?php } ?> <?php } ?> </ul> </div> </div> <?php echo $after_widget; ?> <?php /* Reset the global $the_post as this query will have stomped on it. */ wp_reset_postdata(); } else { echo "<div>No slider items to show. Please select a group that contains some items!</div>"; } }
if (has_nav_menu(PC_CUSTOM_NAV_MENU_2)) { ?> <nav class="secondary-menu"> <?php $args = array('theme_location' => PC_CUSTOM_NAV_MENU_2); wp_nav_menu($args); ?> </nav> <?php } ?> <div id="logo-wrap"> <?php // Output a logo if defined, otherwise the site title PC_Utility::pc_display_theme_logo($options); $options = get_option(PC_OPTIONS_DB_NAME); if (!isset($options['chk_hide_description'])) { ?> <div id="site-description"><?php bloginfo('description'); ?> </div> <?php } ?> </div><!-- #logo-wrap --> <?php get_sidebar('header');
function widget($args, $instance) { extract($args); echo $before_widget; $title = $instance['title']; $description = $instance['description']; if (!empty($title)) { echo $before_title . $title . $after_title; } // ===================================================== // START - Handle the submitted color-switcher form code // ===================================================== // Add in the color scheme from theme options // If color switcher cookie set then use it in preference to the theme color option if (isset($_COOKIE[PC_THEME_NAME_SLUG . "_color_scheme"])) { // Set color scheme from cookie value $col_scheme = $_COOKIE[PC_THEME_NAME_SLUG . "_color_scheme"]; } else { // set color scheme from theme options $options = get_option(PC_OPTIONS_DB_NAME); $col_scheme = $options[PC_COLOR_SCHEME_DROPDOWN]; } // =================================================== // END - Handle the submitted color-switcher form code // =================================================== ?> <div class="color-switcher-container"> <?php if (!empty($description)) { ?> <p class="color-switcher-description"><?php echo $description; ?> </p> <?php } ?> <form action="<?php echo PC_Utility::currURL(); // current page url ?> " method="post"> <?php _e('Color Scheme', 'presscoders'); ?> : <select name='<?php echo PC_THEME_NAME_SLUG; ?> _color_scheme_widget_dropdown' onchange="this.form.submit();"> <?php // Grab global color scheme array global $pc_color_schemes; foreach ($pc_color_schemes as $color_scheme => $value) { echo "<option value='" . $value . "' " . selected($value, $col_scheme) . ">" . $color_scheme . " </option>"; } ?> </select> <input type="hidden" name="color_scheme_submitted" value="true" /> </form> </div> <?php echo $after_widget; }
/** * [testimonial] shortcode function. * * Example usage: [testimonial]Add testimonial here.[/testimonial] * * @todo This shortcode can probably be moved to the deprecated section. * * @since 0.1.0 */ public function testimonial_shortcode($atts, $content = NULL) { // Support self-closing, and enclosing shortcodes (but does not like mixed on the same page/post) extract(shortcode_atts(array('image' => '', 'name' => '', 'company' => ''), $atts)); if (!empty($image)) { $image = PC_Utility::validate_image_str($image); } if (empty($content)) { $content = __('Please add your testimonial in-between opening and closing tags: e.g. [testimonial]Your testimonial here..[/testimonial]', 'presscoders'); } if (!empty($name)) { $name = "<p class=\"testimonial-name\">{$name}</p>"; } if (!empty($company)) { $company = "<p class=\"testimonial-company\">{$company}</p>"; } return "<div class=\"testimonial\"><div class=\"quote\"><p>{$content}</p></div><div class=\"testimonial-meta\">{$image}{$name}{$company}</div></div>"; }
/** * Check favicon url is valid. * * @since 0.1.0 */ public static function get_custom_favicon() { $options = get_option(PC_OPTIONS_DB_NAME); $favicon = $options['txt_favicon']; if (isset($favicon) && !empty($favicon)) { /* If variable set, and non-empty. */ if (self::checkLink($favicon)) { /* If favicon url contains 'http://'. */ $allowed = array('ico', 'png', 'jpg', 'gif'); $ext = substr($favicon, -3); if (in_array($ext, $allowed)) { /* If the extension is valid. */ return $favicon; } } } /* Favicon url set in theme options doesn't exist or seem to be valid. So, use theme default or child theme favicon. */ $favicon = PC_Utility::theme_resource_uri('images', array('favicon.ico', 'favicon.png', 'favicon.jpg', 'favicon.gif')); return $favicon; }
?> </a></span> <?php } ?> </p> </div><!-- .post-meta --> <?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 global $more; $more = 0; the_content(' ' . __('Read More', 'presscoders')); wp_link_pages(array('before' => '<div class="page-link">', 'after' => '</div>')); ?> </div> <!-- .post-content -->
/** * This function is executed once after theme activation. * * @since 0.1.0 */ public function after_theme_activated() { /* Flush permalinks only ONCE after theme activation and custom taxonomies registered (these will have been registered before this function executes). */ PC_Utility::flush_permalink_rules(); }
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 }
/** * Renders the sidebar commander on post/page editor. * * @since 0.1.0 */ public function theme_meta_box_widget_areas($post, $args) { // Retrieve our custom meta box values $pc_primary_widget_areas = get_post_meta($post->ID, '_' . PC_THEME_NAME_SLUG . '_primary_sort', true); $pc_secondary_widget_areas = get_post_meta($post->ID, '_' . PC_THEME_NAME_SLUG . '_secondary_sort', true); $pc_main_content_widget_areas = get_post_meta($post->ID, '_' . PC_THEME_NAME_SLUG . '_main_content_sort', true); $pc_theme_widget_areas_save = get_post_meta($post->ID, '_' . PC_THEME_NAME_SLUG . '_widget_areas_save', true); ?> <script type="text/javascript"> jQuery(document).ready(function($) { // Enable jQuery UI tabs jQuery(document).ready(function($) { $(".tabs").tabs(); }); // Set-up sortable and placeholders for sidebar commander $( "#primary_widget_areas, #secondary_widget_areas, #main_content_widget_areas" ).sortable({ placeholder: "ui-state-highlight" }); // Make sure the link text can' be selected whilst dragging $( "#primary_widget_areas, #secondary_widget_areas, #main_content_widget_areas" ).disableSelection(); // When page loads set the initial opacity of checked checkboxes to 100% $("input:checkbox:checked").parent( 'li' ).each(function (i) { if(jQuery.support.opacity) { $(this).css("opacity", "1"); } else { this.style.filter = "alpha(opacity=100)"; // IE fix } }); // When page loads set the initial opacity of unchecked checkboxes to 30% $("input:checkbox:not(:checked)").parent( 'li' ).each(function (i) { if(jQuery.support.opacity) { $(this).css("opacity", "0.30"); } else { this.style.filter = "alpha(opacity=30)"; // IE fix } }); // When a checkbox is clicked, toggle the opacity $("input:checkbox").click(function () { if( this.checked ) { $(this).parent( 'li' ).css("opacity", "1"); } else { $(this).parent( 'li' ).css("opacity", "0.30"); } }); }); </script> <?php // Get column layout for this post/page $pc_column_layout = get_post_meta($post->ID, '_' . PC_THEME_NAME_SLUG . '_column_layout', true); // Get the page template used by this page (if a page) if ($args['args']['type'] == "page") { $pc_page_template = get_post_meta(get_the_ID(), '_wp_page_template', true); } $options = get_option(PC_OPTIONS_DB_NAME); if (empty($pc_column_layout) || $pc_column_layout == 'default') { $layout = $options[PC_DEFAULT_LAYOUT_THEME_OPTION]; } else { $layout = $pc_column_layout; } $layout_text_after = ""; //$layout_text_after = " is indicated by the icon to the left.<br /><br />"; if ($layout == "1-col") { // Define the layout icons to show on each visible tab $main_content_layout_icon = PC_THEME_ROOT_URI . '/api/images/layout-icons/full.png'; // Define the layout text $main_content_layout_text = ""; //$main_content_layout_text = "The <span class=\"underline\">main content</span> location for this ".$args['args']['type']." with the current layout (1-col, full width) "; } elseif ($layout == "2-col-l") { // Define the layout icons to show on each visible tab $primary_layout_icon = PC_THEME_ROOT_URI . '/api/images/layout-icons/primary-left.png'; $main_content_layout_icon = PC_THEME_ROOT_URI . '/api/images/layout-icons/main-right.png'; // Define the layout text $primary_layout_text = ""; $main_content_layout_text = ""; //$primary_layout_text = "The <span class=\"underline\">primary</span> sidebar location for this ".$args['args']['type']." with the current layout (2-col, sidebar left) "; //$main_content_layout_text = "The <span class=\"underline\">main content</span> location for this ".$args['args']['type']." with the current layout (2-col, sidebar left) "; } elseif ($layout == "2-col-r") { // Define the layout icons to show on each visible tab $primary_layout_icon = PC_THEME_ROOT_URI . '/api/images/layout-icons/primary-right.png'; $main_content_layout_icon = PC_THEME_ROOT_URI . '/api/images/layout-icons/main-left.png'; // Define the layout text $primary_layout_text = ""; $main_content_layout_text = ""; //$primary_layout_text = "The <span class=\"underline\">primary</span> sidebar location for this ".$args['args']['type']." with the current layout (2-col, sidebar right) "; //$main_content_layout_text = "The <span class=\"underline\">main content</span> location for this ".$args['args']['type']." with the current layout (2-col, sidebar right) "; } elseif ($layout == "3-col-l") { // Define the layout icons to show on each visible tab $primary_layout_icon = PC_THEME_ROOT_URI . '/api/images/layout-icons/3col-left.png'; $secondary_layout_icon = PC_THEME_ROOT_URI . '/api/images/layout-icons/3col-left1.png'; $main_content_layout_icon = PC_THEME_ROOT_URI . '/api/images/layout-icons/3col-main-right.png'; // Define the layout text $primary_layout_text = ""; $secondary_layout_text = ""; $main_content_layout_text = ""; //$primary_layout_text = "The <span class=\"underline\">primary</span> sidebar location for this ".$args['args']['type']." with the current layout (3-col, sidebars left) "; //$secondary_layout_text = "The <span class=\"underline\">secondary</span> sidebar location for this ".$args['args']['type']." with the current layout (3-col, sidebars left) "; //$main_content_layout_text = "The <span class=\"underline\">main content</span> location for this ".$args['args']['type']." with the current layout (3-col, sidebars left) "; } elseif ($layout == "3-col-r") { // Define the layout icons to show on each visible tab $primary_layout_icon = PC_THEME_ROOT_URI . '/api/images/layout-icons/3col-middle1.png'; $secondary_layout_icon = PC_THEME_ROOT_URI . '/api/images/layout-icons/3col-right.png'; $main_content_layout_icon = PC_THEME_ROOT_URI . '/api/images/layout-icons/3col-main-left.png'; // Define the layout text $primary_layout_text = ""; $secondary_layout_text = ""; $main_content_layout_text = ""; //$primary_layout_text = "The <span class=\"underline\">primary</span> sidebar location for this ".$args['args']['type']." with the current layout (3-col, sidebars right) "; //$secondary_layout_text = "The <span class=\"underline\">secondary</span> sidebar location for this ".$args['args']['type']." with the current layout (3-col, sidebars right) "; //$main_content_layout_text = "The <span class=\"underline\">main content</span> location for this ".$args['args']['type']." with the current layout (3-col, sidebars right) "; } else { // Layout must be 3-col-c // Define the layout icons to show on each visible tab $primary_layout_icon = PC_THEME_ROOT_URI . '/api/images/layout-icons/3col-left-2.png'; $secondary_layout_icon = PC_THEME_ROOT_URI . '/api/images/layout-icons/3col-right-2.png'; $main_content_layout_icon = PC_THEME_ROOT_URI . '/api/images/layout-icons/3col-main-middle.png'; // Define the layout text $primary_layout_text = ""; $secondary_layout_text = ""; $main_content_layout_text = ""; //$primary_layout_text = "The <span class=\"underline\">primary</span> sidebar location for this ".$args['args']['type']." with the current layout (3-col, content center) "; //$secondary_layout_text = "The <span class=\"underline\">secondary</span> sidebar location for this ".$args['args']['type']." with the current layout (3-col, content center) "; //$main_content_layout_text = "The <span class=\"underline\">main content</span> location for this ".$args['args']['type']." with the current layout (3-col, content center) "; } // Reference the global widget area variable here so we can access it global $wp_registered_sidebars; $tmp_primary_wp_registered_sidebars = $wp_registered_sidebars; // store a primary copy $tmp_secondary_wp_registered_sidebars = $wp_registered_sidebars; // store a secondary copy $tmp_main_content_wp_registered_sidebars = $wp_registered_sidebars; // store a main content copy ?> <div id="page-sidebar-commander"> <div class="tabs"> <?php // Set this to null if not defined to suppress 'not defined' error notices if (!isset($pc_page_template)) { $pc_page_template = null; } // Display message if there are no sidebars or main content areas available if ($layout == "1-col" && $pc_page_template != "widgetized-page.php") { echo "This " . $args['args']['type'] . " has no sidebars, so no unique widget areas can be defined here. Select a two or three column layout to be able to edit sidebar widget areas."; } else { // Show the tabs ?> <!-- the tabs --> <ul> <?php if ($layout != "1-col") { ?> <li><a href="#tabs-primary"><?php _e('Primary Sidebar', 'presscoders'); ?> </a></li> <?php } ?> <?php if ($pc_page_template == "widgetized-page.php") { ?> <li><a href="#tabs-maincontent"><?php _e('Main Content Area', 'presscoders'); ?> </a></li> <?php } ?> <?php if ($layout == "3-col-l" || $layout == "3-col-r" || $layout == "3-col-c") { ?> <li><a href="#tabs-secondary"><?php _e('Secondary Sidebar', 'presscoders'); ?> </a></li> <?php } ?> </ul> <?php } ?> <?php // ** PRIMARY SIDEBAR WIDGET AREAS ** ?> <?php if ($layout != "1-col") { // %1$s $msg = sprintf(__('%1$s%2$sAdd any widget area to the %3$sprimary%4$s sidebar of this %5$s by clicking the checkboxes. Drag and drop to dynamically reorder them. %6$sThe content for each widget area is controlled on the %7$sWidgets%8$s page.', 'presscoders'), $primary_layout_text, $layout_text_after, '<span class="underline">', '</span>', $args['args']['type'], '<br/><br/>', '<a href="' . get_admin_url(null, 'widgets.php') . '">', '</a>'); ?> <div id="tabs-primary"> <ul id="primary_widget_areas"> <?php // Create array with some entries to exclude from widget areas list $exclude_from_primary = array('secondary-post-widget-area', 'secondary-page-widget-area', 'header-widget-area', 'footer-widget-area'); // To avoid confusion, remove secondary sidebars on the primary sidebar list foreach ($exclude_from_primary as $exclude) { if (isset($tmp_primary_wp_registered_sidebars[$exclude])) { unset($tmp_primary_wp_registered_sidebars[$exclude]); } } // Now sort array before printing it if (!empty($pc_primary_widget_areas)) { $tmp_primary_wp_registered_sidebars = PC_Utility::sortMultiArrayByArray($tmp_primary_wp_registered_sidebars, $pc_primary_widget_areas); } if (is_array($tmp_primary_wp_registered_sidebars)) { foreach ($tmp_primary_wp_registered_sidebars as $tmp_primary_wp_registered_sidebar) { // Only show widget areas with a width of 'normal' if ($tmp_primary_wp_registered_sidebar['width'] != "normal") { continue; } if (isset($pc_primary_widget_areas[$tmp_primary_wp_registered_sidebar['id']])) { $chk = checked('1', esc_attr($pc_primary_widget_areas[$tmp_primary_wp_registered_sidebar['id']]), false); } else { $chk = ''; } echo '<li class="ui-state-default"><input type="checkbox" name="' . PC_THEME_NAME_SLUG . '_primary_sort[' . $tmp_primary_wp_registered_sidebar['id'] . ']" id="' . PC_THEME_NAME_SLUG . '_primary_sort[' . $tmp_primary_wp_registered_sidebar['id'] . ']" value="1" ' . $chk . '><label for="' . PC_THEME_NAME_SLUG . '_primary_sort[' . $tmp_primary_wp_registered_sidebar['id'] . ']">' . $tmp_primary_wp_registered_sidebar['name'] . '</label></li>'; } } ?> </ul> <p class="column_message"><img class="layouticon" src="<?php echo $primary_layout_icon; ?> " /><?php echo $msg; ?> </p> </div><!-- #tabs-primary --> <?php } ?> <?php // ** MAIN CONTENT SIDEBAR WIDGET AREAS ** ?> <?php if ($pc_page_template == "widgetized-page.php") { $msg = sprintf(__('%1$s%2$sAdd any widget area to the %3$smain content%4$s area of this %5$s by clicking the checkboxes. Drag and drop to dynamically reorder them. %6$sThe content for each widget area is controlled on the %7$sWidgets%8$s page.', 'presscoders'), $main_content_layout_text, $layout_text_after, '<span class="underline">', '</span>', $args['args']['type'], '<br/><br/>', '<a href="' . get_admin_url(null, 'widgets.php') . '">', '</a>'); ?> <div id="tabs-maincontent"> <ul id="main_content_widget_areas"> <?php // Create array with some entries to exclude from widget areas list //$exclude_from_main_content = array('primary-post-widget-area', 'primary-page-widget-area', 'secondary-post-widget-area', 'secondary-page-widget-area'); // To avoid confusion, remove secondary sidebars on the primary sidebar list /*foreach($exclude_from_main_content as $exclude) { if( isset($tmp_main_content_wp_registered_sidebars[$exclude]) ) { unset($tmp_main_content_wp_registered_sidebars[$exclude]); } }*/ // Now sort array before printing it if (!empty($pc_main_content_widget_areas)) { $tmp_main_content_wp_registered_sidebars = PC_Utility::sortMultiArrayByArray($tmp_main_content_wp_registered_sidebars, $pc_main_content_widget_areas); } if (is_array($tmp_main_content_wp_registered_sidebars)) { foreach ($tmp_main_content_wp_registered_sidebars as $tmp_main_content_wp_registered_sidebar) { // Only show widget areas with a width of 'wide' if ($tmp_main_content_wp_registered_sidebar['width'] != "wide") { continue; } if (isset($pc_main_content_widget_areas[$tmp_main_content_wp_registered_sidebar['id']])) { $chk = checked('1', esc_attr($pc_main_content_widget_areas[$tmp_main_content_wp_registered_sidebar['id']]), false); } else { $chk = ''; } echo '<li class="ui-state-default"><input type="checkbox" name="' . PC_THEME_NAME_SLUG . '_main_content_sort[' . $tmp_main_content_wp_registered_sidebar['id'] . ']" id="' . PC_THEME_NAME_SLUG . '_main_content_sort[' . $tmp_main_content_wp_registered_sidebar['id'] . ']" value="1" ' . $chk . '><label for="' . PC_THEME_NAME_SLUG . '_main_content_sort[' . $tmp_main_content_wp_registered_sidebar['id'] . ']">' . $tmp_main_content_wp_registered_sidebar['name'] . '</label></li>'; } } ?> </ul> <p class="column_message"><img class="layouticon" src="<?php echo $main_content_layout_icon; ?> " /><?php echo $msg; ?> </p> </div><!-- #tabs-maincontent --> <?php } // endif ?> <?php // ** SECONDARY SIDEBAR WIDGET AREAS ** ?> <?php if ($layout == "3-col-l" || $layout == "3-col-r" || $layout == "3-col-c") { $msg = sprintf(__('%1$s%2$sAdd any widget area to the %3$ssecondary%4$s sidebar of this %5$s by clicking the checkboxes. Drag and drop to dynamically reorder them. %6$sThe content for each widget area is controlled on the %7$sWidgets%8$s page.', 'presscoders'), $secondary_layout_text, $layout_text_after, '<span class="underline">', '</span>', $args['args']['type'], '<br/><br/>', '<a href="' . get_admin_url(null, 'widgets.php') . '">', '</a>'); ?> <div id="tabs-secondary"> <ul id="secondary_widget_areas"> <?php // Create array with some entries to exclude from widget areas list $exclude_from_secondary = array('primary-post-widget-area', 'primary-page-widget-area', 'header-widget-area', 'footer-widget-area'); // To avoid confusion, remove secondary sidebars on the secondary sidebar list foreach ($exclude_from_secondary as $exclude) { if (isset($tmp_secondary_wp_registered_sidebars[$exclude])) { unset($tmp_secondary_wp_registered_sidebars[$exclude]); } } // Now sort array before printing it if (!empty($pc_secondary_widget_areas)) { $tmp_secondary_wp_registered_sidebars = PC_Utility::sortMultiArrayByArray($tmp_secondary_wp_registered_sidebars, $pc_secondary_widget_areas); } if (is_array($tmp_secondary_wp_registered_sidebars)) { foreach ($tmp_secondary_wp_registered_sidebars as $tmp_secondary_wp_registered_sidebar) { // Only show widget areas with a width of 'normal' if ($tmp_secondary_wp_registered_sidebar['width'] != "normal") { continue; } if (isset($pc_secondary_widget_areas[$tmp_secondary_wp_registered_sidebar['id']])) { $chk = checked('1', esc_attr($pc_secondary_widget_areas[$tmp_secondary_wp_registered_sidebar['id']]), false); } else { $chk = ''; } echo '<li class="ui-state-default"><input type="checkbox" name="' . PC_THEME_NAME_SLUG . '_secondary_sort[' . $tmp_secondary_wp_registered_sidebar['id'] . ']" id="' . PC_THEME_NAME_SLUG . '_secondary_sort[' . $tmp_secondary_wp_registered_sidebar['id'] . ']" value="1" ' . $chk . '><label for="' . PC_THEME_NAME_SLUG . '_secondary_sort[' . $tmp_secondary_wp_registered_sidebar['id'] . ']">' . $tmp_secondary_wp_registered_sidebar['name'] . '</label></li>'; } } ?> </ul> <p class="column_message"><img class="layouticon" src="<?php echo $secondary_layout_icon; ?> " /><?php echo $msg; ?> </p> </div><!-- #tabs-secondary --> <?php } ?> </div><!-- .tabs --> <input type="hidden" name="<?php echo PC_THEME_NAME_SLUG; ?> _widget_areas_save" id="<?php echo PC_THEME_NAME_SLUG; ?> _widget_areas_save" value="<?php echo esc_attr($pc_theme_widget_areas_save); ?> "> </div><!-- #page-sidebar-commander --> <?php }