Skip to content

Commit

Permalink
Merge branch 'master' of github.com:krogsgard/wporg-developer
Browse files Browse the repository at this point in the history
Conflicts:
	content.php
	footer.php
	functions.php
	header.php
	index.php
	style.css
  • Loading branch information
krogsgard committed Jan 14, 2014
2 parents 3e0b03c + 4c1e2ff commit f04c3bb
Show file tree
Hide file tree
Showing 10 changed files with 1,778 additions and 69 deletions.
31 changes: 31 additions & 0 deletions archive-wpapi-function.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php namespace DevHub; ?>
<?php get_header(); ?>

<div class="<?php body_class( 'pagebody' ) ?>">
<div class="wrapper">

<?php breadcrumb_trail(); ?>

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

<?php /** @var \WP_Query $wp_query */ if ( $wp_query->current_post ) : ?>
<hr />
<?php endif; ?>

<?php get_template_part( 'content', get_post_type() ); ?>

<?php endwhile; ?>

<?php else : ?>

<h1><?php _e( 'Not Found', 'wporg' ); ?></h1>

<?php endif; ?>

<?php loop_pagination(); ?>

</div>
<!-- /wrapper -->
</div><!-- /pagebody -->

<?php get_footer(); ?>
29 changes: 29 additions & 0 deletions content-wpapi-function.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php namespace DevHub; ?>

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

<h1><a href="<?php the_permalink() ?>"><?php echo get_signature(); ?></a></h1>

<section class="description">
<?php the_excerpt(); ?>
</section>

<section class="long-description">
<?php the_content(); ?>
</section>

<section class="return"><strong>Return:</strong> <?php echo get_return(); ?></section>

<?php
$since = get_since();
if ( ! empty( $since ) ) :
?>
<section class="since">
<strong>Since:</strong> WordPress
<a href="<?php echo get_since_link( $since ); ?>"><?php echo $since; ?></a>
</section>
<?php endif; ?>

<section class="meta">Used by TODO | Uses TODO | TODO Examples</section>

</article>
5 changes: 1 addition & 4 deletions footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@

</div><!-- #page -->

<?php wp_footer(); ?>
<?php
#require WPORGPATH . 'footer.php';
get_template_part( 'org', 'footer' );

?>
require WPORGPATH . 'footer.php';
63 changes: 63 additions & 0 deletions front-page.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?php get_header(); ?>

<div class="pagebody">
<div class="wrapper">

<div class="reference-landing">

<div class="search-guide section clear">
<h3><?php _e( 'Find what you need:', 'wporg' ); ?></h3>
<?php get_search_form(); ?>
</div><!-- /search-guide -->

<div class="topic-guide section">
<h4><?php _e( 'Or browse through topics:', 'wporg' ); ?></h4>
<ul class="unordered-list horizontal-list no-bullets">
<li><a href="<?php echo get_post_type_archive_link( 'wpapi-function' ) ?>"><?php _e( 'Functions', 'wporg' ); ?></a></li>
<li><a href="<?php echo get_post_type_archive_link( 'wpapi-hook' ) ?>"><?php _e( 'Hooks', 'wporg' ); ?></a></li>
<li><a href="<?php echo get_post_type_archive_link( 'wpapi-class' ) ?>"><?php _e( 'Classes', 'wporg' ); ?></a></li>
</ul>
</div><!-- /topic-guide -->

<div class="new-in-guide section clear">
<div class="widget box box-left">
<h3 class="widget-title"><?php $version = DevHub\get_current_version(); printf( __( 'New in %s:', 'wporg' ), $version->name ); ?></h3>
<ul class="unordered-list no-bullets">
<?php

$list = new WP_Query( array(
'posts_per_page' => 10,
'post_type' => array( 'wpapi-function', 'wpapi-hook', 'wpapi-class' ),
'orderby' => 'title',
'order' => 'ASC',
'tax_query' => array( array(
'taxonomy' => 'wpapi-since',
'field' => 'ids',
'terms' => $version->term_id,
) ),
) );

while ( $list->have_posts() ) : $list->the_post();

echo '<li><a href="' . get_permalink() . '">' . get_the_title() . '</a></li>';

endwhile;
?>
</ul>
</div>
<div class="widget box box-right">
<h3 class="widget-title"><?php _e( 'APIs', 'wporg' ); ?></h3>
<ul class="unordered-list no-bullets">
<li><a href="#">Some API</a></li>
<li><a href="#">Some other API</a></li>
<li><a href="#">Another new API</a></li>
</ul>
</div>
</div><!-- /new-in-guide -->

</div><!-- /reference-landing -->

</div><!-- /wrapper -->
</div><!-- /pagebody -->

<?php get_footer(); ?>
215 changes: 152 additions & 63 deletions functions.php
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,56 +1,66 @@
<?php

namespace DevHub;

/**
* wporg-developer functions and definitions
*
* @package wporg-developer
* Custom template tags for this theme.
*/
require __DIR__ . '/inc/template-tags.php';

/**
* Set the content width based on the theme's design and stylesheet.
* Custom functions that act independently of the theme templates.
*/
if ( ! isset( $content_width ) ) {
$content_width = 640; /* pixels */
require __DIR__ . '/inc/extras.php';

/**
* Customizer additions.
*/
require __DIR__ . '/inc/customizer.php';

/**
* Load Jetpack compatibility file.
*/
require __DIR__ . '/inc/jetpack.php';

if ( ! function_exists( 'loop_pagination' ) ) {
require __DIR__ . '/php/loop-pagination.php';
}

if ( ! function_exists( 'breadcrumb_trail' ) ) {
require __DIR__ . '/php/breadcrumb-trail.php';
}

if ( ! function_exists( 'wporg_developer_setup' ) ) :
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which
* runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails.
* Set the content width based on the theme's design and stylesheet.
*/
function wporg_developer_setup() {
if ( ! isset( $content_width ) ) {
$content_width = 640; /* pixels */
}

/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on wporg-developer, use a find and replace
* to change 'wporg-developer' to the name of your theme in all the template files
*/
load_theme_textdomain( 'wporg-developer', get_template_directory() . '/languages' );

// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
add_action( 'init', __NAMESPACE__ . '\\init' );

/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
*/
add_theme_support( 'post-thumbnails' );

// Enable support for Post Formats.
add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link' ) );
function init() {

register_post_types();
register_taxonomies();
add_action( 'widgets_init', __NAMESPACE__ . '\\widgets_init' );
add_action( 'pre_get_posts', __NAMESPACE__ . '\\pre_get_posts' );
add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\\theme_scripts_styles' );
add_filter( 'post_type_link', __NAMESPACE__ . '\\method_permalink', 10, 2 );
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'post-thumbnails' );
}
endif; // wporg_developer_setup
add_action( 'after_setup_theme', 'wporg_developer_setup' );


/**
* Register widgetized area and update sidebar with default widgets.
* widgets_init function.
*
* @access public
* @return void
*/
function wporg_developer_widgets_init() {
function widgets_init() {
register_sidebar( array(
'name' => __( 'Sidebar', 'wporg-developer' ),
'id' => 'sidebar-1',
Expand All @@ -60,46 +70,125 @@ function wporg_developer_widgets_init() {
'after_title' => '</h1><div class="widget-content">',
) );
}
add_action( 'widgets_init', 'wporg_developer_widgets_init' );

/**
* Enqueue scripts and styles.
* @param \WP_Query $query
*/
function wporg_developer_scripts() {
wp_enqueue_style( 'dashicons' );

wp_enqueue_style( 'open-sans', '//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,400,300,600' );

wp_enqueue_style( 'wporg-developer-style', get_stylesheet_uri() );

wp_enqueue_style( 'wp-dev-sass-compiled', get_template_directory_uri() . '/main.css', array( 'wporg-developer-style' ) );
function pre_get_posts( $query ) {

wp_enqueue_script( 'wporg-developer-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120206', true );

wp_enqueue_script( 'wporg-developer-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true );

if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
if ( $query->is_main_query() && $query->is_post_type_archive() ) {
$query->set( 'orderby', 'title' );
$query->set( 'order', 'ASC' );
}
}
add_action( 'wp_enqueue_scripts', 'wporg_developer_scripts' );

/**
* Custom template tags for this theme.
* Register the function and class post types
*/
require get_template_directory() . '/inc/template-tags.php';
function register_post_types() {
$supports = array(
'comments',
'custom-fields',
'editor',
'excerpt',
'revisions',
'title',
);

// Functions
register_post_type( 'wpapi-function', array(
'has_archive' => 'functions',
'label' => __( 'Functions', 'wporg' ),
'public' => true,
'rewrite' => array(
'feeds' => false,
'slug' => 'reference/function',
'with_front' => false,
),
'supports' => $supports,
) );

/**
* Custom functions that act independently of the theme templates.
*/
require get_template_directory() . '/inc/extras.php';
// Methods
add_rewrite_rule( 'method/([^/]+)/([^/]+)/?$', 'index.php?post_type=wpapi-function&name=$matches[1]-$matches[2]', 'top' );

// Classes
register_post_type( 'wpapi-class', array(
'has_archive' => 'classes',
'label' => __( 'Classes', 'wporg' ),
'public' => true,
'rewrite' => array(
'feeds' => false,
'slug' => 'reference/class',
'with_front' => false,
),
'supports' => $supports,
) );

/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
// Hooks
register_post_type( 'wpapi-hook', array(
'has_archive' => 'hooks',
'label' => __( 'Hooks', 'wporg' ),
'public' => true,
'rewrite' => array(
'feeds' => false,
'slug' => 'reference/hook',
'with_front' => false,
),
'supports' => $supports,
) );
}

/**
* Load Jetpack compatibility file.
* Register the file and @since taxonomies
*/
require get_template_directory() . '/inc/jetpack.php';
function register_taxonomies() {
// Files
register_taxonomy( 'wpapi-source-file', array( 'wpapi-class', 'wpapi-function', 'wpapi-hook' ), array(
'label' => __( 'Files', 'wporg' ),
'public' => true,
'rewrite' => array( 'slug' => 'reference/files' ),
'sort' => false,
'update_count_callback' => '_update_post_term_count',
) );

// Package
register_taxonomy( 'wpapi-package', array( 'wpapi-class', 'wpapi-function', 'wpapi-hook' ), array(
'hierarchical' => true,
'label' => '@package',
'public' => true,
'rewrite' => array( 'slug' => 'reference/package' ),
'sort' => false,
'update_count_callback' => '_update_post_term_count',
) );

// @since
register_taxonomy( 'wpapi-since', array( 'wpapi-class', 'wpapi-function', 'wpapi-hook' ), array(
'hierarchical' => true,
'label' => __( '@since', 'wporg' ),
'public' => true,
'rewrite' => array( 'slug' => 'reference/since' ),
'sort' => false,
'update_count_callback' => '_update_post_term_count',
) );
}

function method_permalink( $link, $post ) {
if ( $post->post_type !== 'wpapi-function' || $post->post_parent == 0 )
return $link;

list( $class, $method ) = explode( '-', $post->post_name );
$link = home_url( user_trailingslashit( "method/$class/$method" ) );
return $link;
}

function theme_scripts_styles() {
wp_enqueue_style( 'dashicons' );
wp_enqueue_style( 'open-sans', '//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,400,300,600' );
wp_enqueue_style( 'wporg-developer-style', get_stylesheet_uri() );
wp_enqueue_style( 'wp-dev-sass-compiled', get_template_directory_uri() . '/main.css', array( 'wporg-developer-style' ) );
wp_enqueue_script( 'wporg-developer-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120206', true );
wp_enqueue_script( 'wporg-developer-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
Loading

0 comments on commit f04c3bb

Please sign in to comment.