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
| <style> | |
| ul {margin:0; padding:0; list-style:none; overflow:auto} | |
| ul li {float:left} | |
| ul.half li {width:50%} | |
| ul.thirds li {width:calc(100% / 3); width:33.33%} | |
| ul.quarters li {width:25%} | |
| </style> | |
| <?php | |
| if( have_rows('repeater_field_name') ): | |
| $repeater = get_field('repeater_field_name'); |
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
| <?php | |
| $image = get_field('image'); | |
| if( !empty($image) ): | |
| $url = $image['url']; | |
| $thumb = $image['sizes'][ 'thumbnail' ]; | |
| echo '<img src="' . $url . '">'; // full size image | |
| echo '<img src="' . $thumb . '">'; // thumbnail image | |
| endif; | |
| ?> |
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
| <?php | |
| // Add the custom post type | |
| function create_post_type() { | |
| register_post_type( 'kit-lists', | |
| array( | |
| 'labels' => array( | |
| 'name' => __( 'Kit Lists' ), | |
| 'singular_name' => __( 'Kit List' ) | |
| ), | |
| 'public' => true, |
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
| <link rel="shortcut icon" href="<?php bloginfo( 'template_directory' ); ?>/favicon/favicon.ico" /> | |
| <link rel="apple-touch-icon" sizes="152x152" href="<?php bloginfo( 'template_directory' ); ?>/favicon/favicon-152.png" /> | |
| <link rel="apple-touch-icon" sizes="180x180" href="<?php bloginfo( 'template_directory' ); ?>/favicon/favicon-180.png"> | |
| <link rel="apple-touch-icon" sizes="167x167" href="<?php bloginfo( 'template_directory' ); ?>/favicon/favicon-167.png"> | |
| <meta name="msapplication-TileColor" content="#000000"> | |
| <meta name="msapplication-TileImage" content="<?php bloginfo( 'template_directory' ); ?>/favicon/favicon-144.png"> |
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
| <style> | |
| div.panel {width:100%; height:100vh; background-position:center center; background-repeat:no-repeat; -webkit-background-size:cover; -moz-background-size:cover; -o-background-size:cover; background-size:cover} | |
| </style> | |
| <?php | |
| // Image field with a return value of Image Array | |
| $background_image = get_field('background_image'); | |
| echo '<div class="panel"'; | |
| if ( $background_image ) { | |
| $size = 'large'; |
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
| <?php | |
| // This alters the main loop (loop.php) to order Archive queries by Title | |
| function archive_posts($query) { | |
| if ( $query->is_archive() ) { | |
| $query->set( 'orderby', 'title' ); | |
| $query->set( 'order', 'asc' ); | |
| } | |
| } | |
| add_action('pre_get_posts', 'archive_posts'); | |
| ?> |
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
| <style> | |
| div.traverse {width: 100%; clear: both} | |
| div.traverse a {display: block; width: 50%} | |
| div.traverse a.prev {float: left} | |
| div.traverse a.next {float: right; text-align: right} | |
| </style> | |
| <?php | |
| // The traverse navigation to adjacent posts | |
| $prev_post = get_adjacent_post(false, '', true); |
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
| <?php | |
| $post_thumbnail_id = get_post_thumbnail_id(); | |
| $image_attributes = wp_get_attachment_image_src( $post_thumbnail_id, 'full' ); | |
| if ( $image_attributes ) { | |
| $width = $image_attributes[1]; | |
| $height = $image_attributes[2]; | |
| if ( $width > $height ) { | |
| echo get_the_post_thumbnail( $post_id, 'medium', array( 'class' => 'landscape' ) ); | |
| } elseif ( $width < $height ) { | |
| echo get_the_post_thumbnail( $post_id, 'medium', array( 'class' => 'portrait' ) ); |
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
| <?php | |
| /* Here we grab posts from the main site */ | |
| function get_other_posts(){ | |
| $wpdb_old = wp_clone($GLOBALS['wpdb']); | |
| $wpdb_new = &$GLOBALS['wpdb']; | |
| $wpdb_new = new wpdb('your_db_username','db_password','new_db_name','localhost'); | |
| $wpdb_new->set_prefix('wp_'); | |
| $otherposts = get_posts(); | |
| if ( $otherposts ) { | |
| echo '<ul>'; |