Permalink
Browse files

The Theme used in Responsive Design with WordPress

Changes may be forthcoming.
  • Loading branch information...
jcasabona committed Dec 16, 2013
0 parents commit 04c7f93c389236e602fb03051056444cb7c13eb5
Showing with 2,553 additions and 0 deletions.
  1. +26 −0 millennium-flights/Select_Nav_Walker.php
  2. +44 −0 millennium-flights/archives.php
  3. +15 −0 millennium-flights/comments-single.php
  4. +43 −0 millennium-flights/comments.php
  5. +30 −0 millennium-flights/footer.php
  6. +223 −0 millennium-flights/functions.php
  7. +28 −0 millennium-flights/header.php
  8. BIN millennium-flights/images/apollo.jpg
  9. BIN millennium-flights/images/box.jpg
  10. BIN millennium-flights/images/exotic.jpg
  11. BIN millennium-flights/images/logo.png
  12. BIN millennium-flights/images/space.jpg
  13. +27 −0 millennium-flights/index.php
  14. +1 −0 millennium-flights/js/picturefill.js
  15. +6 −0 millennium-flights/js/respond.min.js
  16. +12 −0 millennium-flights/js/responsive-nav.min.js
  17. +31 −0 millennium-flights/page-home.php
  18. +24 −0 millennium-flights/page.php
  19. +5 −0 millennium-flights/searchform.php
  20. +29 −0 millennium-flights/sidebar.php
  21. +56 −0 millennium-flights/single.php
  22. +566 −0 millennium-flights/style.css
  23. +97 −0 millennium-flights/wurfl/Cache/CacheInterface.php
  24. +77 −0 millennium-flights/wurfl/Cache/Cookie.php
  25. +62 −0 millennium-flights/wurfl/Cache/Null.php
  26. +470 −0 millennium-flights/wurfl/Client/Client.php
  27. +160 −0 millennium-flights/wurfl/Client/Config.php
  28. +60 −0 millennium-flights/wurfl/Client/Exception.php
  29. +103 −0 millennium-flights/wurfl/HttpClient/AbstractHttpClient.php
  30. +80 −0 millennium-flights/wurfl/HttpClient/Curl.php
  31. +35 −0 millennium-flights/wurfl/HttpClient/Factory.php
  32. +99 −0 millennium-flights/wurfl/HttpClient/Fsock.php
  33. +71 −0 millennium-flights/wurfl/LICENSE.txt
  34. +73 −0 millennium-flights/wurfl/README.txt
@@ -0,0 +1,26 @@
<?php
class Select_Nav_Walker extends Walker_Nav_Menu {
// don't output children opening tag (`<ul>`)
public function start_lvl(&$output, $depth){}
// don't output children closing tag
public function end_lvl(&$output, $depth){}
public function start_el(&$output, $item, $depth, $args){
// add spacing to the title based on the current depth
$item->title = esc_attr($item->title);
// call the prototype and replace the <li> tag
// from the generated markup...
parent::start_el(&$output, $item, $depth, $args);
$output .= ' <option value="'. $item->url .'">'. $item->title;
}
// replace closing </li> with the closing option tag
public function end_el(&$output, $item, $depth){
$output .= "</option>\n";
}
}
?>
@@ -0,0 +1,44 @@
<?php
/**
* @package WordPress
* @subpackage Default_Theme
*/
/*
Template Name: Archives
*/
?>
<?php get_header(); ?>
<div class="post group">
<h2>Search</h2>
<?php get_search_form(); ?>
<div class="date-archives">
<h2>Archives</h2>
<ul class="compact-archives">
<?php compact_archive('block'); ?>
</ul>
</div>
<div class="tag-archives">
<h2>Tag Cloud</h2>
<div class="tags">
<?php
if(ISMOBILE){
$args= "orderby=count&order=DESC&number=30";
mf_tag_cloud($args);
}else{
wp_tag_cloud('smallest=0.9&largest=2.2&unit=em');
}
?>
</div>
</div>
</div>
<?php get_footer(); ?>
@@ -0,0 +1,15 @@
<?php get_header(); ?>
<div class="entry">
<h2>Comments for <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<div class="commentsection">
<ol class="commentlist">
<?php
wp_list_comments('reverse_top_level=false', get_comments('post_id='.$post->ID));
comment_form();
?>
</ol>
</div>
</div>
<?php get_footer(); ?>
@@ -0,0 +1,43 @@
<?php
// Do not delete these lines
if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
die ('Please do not load this page directly. Thanks!');
if ( post_password_required() ) { ?>
<p class="nocomments">This post is password protected. Enter the password to view comments.</p>
<?php
return;
}
?>
<!-- You can start editing here. -->
<?php if ( have_comments() ) : ?>
<h3 id="comments"><?php comments_number('No Comments', 'One Comment', '% Comments' );?> to &#8220;<?php the_title(); ?>&#8221;</h3>
<ol class="commentlist">
<?php wp_list_comments(); ?>
</ol>
<div id="commentNav" class="navigation group">
<div class="alignleft"><?php previous_comments_link() ?></div>
<div class="alignright"><?php next_comments_link() ?></div>
</div>
<?php else : // this is displayed if there are no comments so far ?>
<?php if ( comments_open() ) : ?>
<!-- If comments are open, but there are no comments. -->
<?php else : // comments are closed ?>
<!-- If comments are closed. -->
<p class="nocomments">Comments are closed.</p>
<?php endif; ?>
<?php endif; ?>
<?php if ( comments_open() ) : ?>
<?php comment_form(); ?>
<?php endif; // if you delete this the sky will fall on your head ?>
@@ -0,0 +1,30 @@
</div>
<footer>
<aside class="group">
<?php if (!dynamic_sidebar('Sidebar2')) : ?>
<?php endif; ?>
</aside>
<?php if(ISMOBILE){ ?>
<nav id="footernav">
<?php wp_nav_menu( array('menu' => 'Main' )); ?>
</nav>
<?php } ?>
<p>&copy; <a href="http://manifest-dev.org">Millennium Flights</a>, 2013.</p>
</footer>
</div>
<?php wp_footer(); ?>
</body>
</html>
@@ -0,0 +1,223 @@
<?php
define( 'TEMPPATH', get_bloginfo('stylesheet_directory'));
define( 'IMAGES', TEMPPATH. "/images");
require_once('wurfl/Client/Client.php');
if ( function_exists( 'add_theme_support' ) ) {
add_theme_support( 'post-thumbnails' );
add_theme_support( 'menus' );
}
register_sidebar( array (
'name' => __( 'Sidebar', 'main-sidebar' ),
'id' => 'primary-widget-area',
'description' => __( 'The primary widget area', 'wpbp' ),
'before_widget' => '<div class="widget">',
'after_widget' => "</div>",
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
register_sidebar( array (
'name' => __( 'Sidebar2', 'secondary-sidebar' ),
'id' => 'secondar-widget-area',
'description' => __( 'The seconardy widget area', 'wpbp' ),
'before_widget' => '<div class="widget">',
'after_widget' => "</div>",
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
require_once('Select_Nav_Walker.php');
function jlc_get_attachements($pid){
$args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => $pid );
$attachments = get_posts( $args );
if ($attachments) {
foreach ( $attachments as $post ) {
setup_postdata($post);
the_attachment_link($post->ID, false, false, true);
}
}
}
function jlc_page_url() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
function mf_print_post_nav(){
?>
<div class="navigation group">
<div class="alignleft"><?php next_posts_link('&laquo; Next') ?></div>
<div class="alignright"><?php previous_posts_link('Previous &raquo;') ?></div>
</div>
<?php
}
function mf_print_not_found(){
?>
<h3 class="center">No posts found. Try a different search?</h3>
<?php get_search_form(); ?>
<?php
}
function mf_comments_page_link(){
echo '<a href="'. get_permalink() . 'comments/">'. get_comments_number() .' Comments</a>';
}
function mf_is_mobile_device(){
try{
$config = new WurflCloud_Client_Config();
$config->api_key = '673289:CNry9beZIoP38Kn2z1WRQcAU6Fqd0TwS';
$client = new WurflCloud_Client_Client($config);
$client->detectDevice();
return $client->getDeviceCapability('is_wireless_device');
}catch (Exception $e){
return wp_is_mobile();
}
}
define( 'ISMOBILE', mf_is_mobile_device());
function mf_scripts() {
wp_enqueue_style( 'googlewebfonts', 'http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300' );
wp_enqueue_script( 'responsivenav', TEMPPATH.'/js/responsive-nav.min.js', array());
echo '<!--[if lt IE 9]>';
echo '<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>';
echo '<script src="'. TEMPPATH .'/js/respond.min.js"></script>';
echo '![endif]-->';
}
add_action( 'wp_enqueue_scripts', 'mf_scripts' );
function mf_responsive_nav(){
echo '<script>
var navigation = responsiveNav("#top-menu");
</script>';
}
add_action('wp_footer', 'mf_responsive_nav');
function mf_ajax_comments(){
if(is_single()){
echo '<script type="text/javascript" charset="utf-8">
jQuery(document).ready(function(){
jQuery(\'#commentNav a\').live(\'click\', function(e){
e.preventDefault();
var link = jQuery(this).attr(\'href\');
jQuery(\'#commentsection\').html(\'Loading...\');
jQuery(\'#commentsection\').load(link+\' #commentsection\');
});
});
</script>';
}
}
add_action('wp_head', 'mf_ajax_comments');
function mf_get_featured_image($html, $aid=false){
$sizes= array('thumbnail', 'medium', 'large', 'full');
$img= '<span data-picture data-alt="'.get_the_title().'">';
$ct= 0;
$aid= (!$aid) ? get_post_thumbnail_id() : $aid;
foreach($sizes as $size){
$url= wp_get_attachment_image_src($aid, $size);
$width= ($ct < sizeof($sizes)-1) ? ($url[1]*0.66) : ($width/0.66)+25;
$img.= '
<span data-src="'. $url[0] .'"';
$img.= ($ct > 0) ? ' data-media="(min-width: '. $width .'px)"></span>' :'></span>';
$ct++;
}
$url= wp_get_attachment_image_src( $aid, $sizes[1]);
$img.= '<noscript>
<img src="'.$url[0] .'" alt="'.get_the_title().'">
</noscript>
</span>';
return $img;
}
add_filter( 'post_thumbnail_html', 'mf_get_featured_image');
function mf_responsive_image($atts, $content=null){
extract( shortcode_atts( array(
'src' => false
), $atts ) );
if(!$src){
return '';
}else{
$aid= mf_get_attachment_id_from_src($src);
$img= mf_get_featured_image('', $aid);
}
return $img;
}
add_shortcode('mf_image', 'mf_responsive_image');
function mf_get_attachment_id_from_src($url) {
global $wpdb;
$prefix = $wpdb->prefix;
$attachment = $wpdb->get_col($wpdb->prepare("SELECT ID FROM " . $prefix . "posts" . " WHERE guid='%s';", $url ));
return $attachment[0];
}
function mf_replace_post_images($content){
global $post;
preg_match('#<img([^>]+?)src=[\'"]?([^\'"\s>]+)[\'"]?([^>]*)>#', $content, $matches);
foreach($matches as $match){
print $match;
preg_replace( $match, mf_get_featured_image(mf_get_attachment_id_from_src ($match)), $content );
}
return $content;
}
//add_filter('the_content', 'mf_replace_post_images');
function mf_tag_cloud($args=''){
$tags = get_tags($args);
$html = '<ul class="wp-tag-cloud">';
foreach ( $tags as $tag ) {
$tag_link = get_tag_link( $tag->term_id );
$progress= $tag->count*2;
$html .= "<li><a href='{$tag_link}' title='{$tag->count} posts' class='{$tag->slug}'>{$tag->name}</a>";
$html .= "<progress max='100' value='{$progress}'>Count: {$tag->count}</progress></li>";
}
$html .= '</ul>';
echo $html;
}
?>
Oops, something went wrong.

0 comments on commit 04c7f93

Please sign in to comment.