Last active
February 3, 2016 10:43
-
-
Save rachelmccollin/a6c7dc269d1d5ba211ae to your computer and use it in GitHub Desktop.
Snippets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function rmcc_register_taxonomy() { | |
| $labels = array( | |
| 'name' => __( 'Weebles' ), | |
| 'singular_name' => __( 'Weeble' ), | |
| 'search_items' => __( 'Search Weebles' ), | |
| 'all_items' => __( 'All Weebles' ), | |
| 'edit_item' => __( 'Edit Weebles' ), | |
| 'update_item' => __( 'Update Weebles' ), | |
| 'add_new_item' => __( 'Add New Weebles' ), | |
| 'new_item_name' => __( 'New Weeble Name' ), | |
| 'menu_name' => __( 'Weeble' ), | |
| ); | |
| $args = array( | |
| 'labels' => $labels, | |
| 'hierarchical' => true, | |
| 'sort' => true, | |
| 'args' => array( 'orderby' => 'term_order' ), | |
| 'rewrite' => array( 'slug' => 'weebles' ), | |
| 'show_admin_column' => true | |
| ); | |
| register_taxonomy( 'weeble', 'posttype', $args); | |
| } | |
| add_action( 'init', 'rmcc_register_taxonomy' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function rmmc_create_post_type() { | |
| $labels = array( | |
| 'name' => __( 'Weebles' ), | |
| 'singular_name' => __( 'Weeble' ), | |
| 'add_new' => __( 'New weeble' ), | |
| 'add_new_item' => __( 'Add New weeble' ), | |
| 'edit_item' => __( 'Edit weeble' ), | |
| 'new_item' => __( 'New weeble' ), | |
| 'view_item' => __( 'View weeble' ), | |
| 'search_items' => __( 'Search weebles' ), | |
| 'not_found' => __( 'No weebles Found' ), | |
| 'not_found_in_trash' => __( 'No weebles found in Trash' ), | |
| ); | |
| $args = array( | |
| 'labels' => $labels, | |
| 'has_archive' => true, | |
| 'public' => true, | |
| 'hierarchical' => false, | |
| 'supports' => array( | |
| 'title', | |
| 'editor', | |
| 'excerpt', | |
| 'custom-fields', | |
| 'thumbnail', | |
| 'page-attributes' | |
| ), | |
| 'taxonomies' => array( 'post_tag', 'category'), | |
| ); | |
| register_post_type( 'name', $args ); | |
| } | |
| add_action( 'init', 'rmmc_create_post_type' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $args = array( | |
| ); | |
| $query = new WP_query ( $args ); | |
| if ( $query->have_posts() ) { ?> | |
| <h3>Heading</h3> | |
| <?php while ( $query->have_posts() ) : $query->the_post(); /* start the loop */ ?> | |
| <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> | |
| <h3 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'compass' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h3> | |
| <?php if ( has_post_thumbnail() ) { ?> | |
| <a href="<?php the_permalink(); ?>"> | |
| <?php the_post_thumbnail( 'medium', array( | |
| 'class' => 'alignleft', | |
| 'alt' => trim(strip_tags( $wp_postmeta->_wp_attachment_image_alt )) | |
| ) ); ?> | |
| </a> | |
| <?php } ?> | |
| <section class="entry-summary"> | |
| <?php the_excerpt(); ?><a href="<?php the_permalink(); ?>">Further information</a>. | |
| </section><!-- .entry-summary --> | |
| OR | |
| <section class="entry-content"> | |
| <?php the_content(); ?> | |
| </section><!-- .entry-content --> | |
| </article> | |
| <?php endwhile; /* end the loop*/ ?> | |
| <?php rewind_posts(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment