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 | |
| // http://php.net/manual/en/function.date.php | |
| //get the time from the ACF time picker see php.net for date formats | |
| $printdate = DateTime::createFromFormat('Ymd', get_post_meta($post->ID, 'event_date', 'true')); //event_date from custom feild | |
| $eventDate = $printdate->format('m/d/Y'); | |
| if (time() < strtotime("$eventDate 11:59PM")) { ?> | |
| <!-- the date has not passed SHOW CONTENT --> | |
| <?php } else { ?> | |
| <!-- SORRY the date has passed already--> |
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 | |
| //check for refering page to switch content based on referrer | |
| $referrer = $_SERVER['HTTP_REFERER']; | |
| if ($referrer == 'http://url.com' or $referrer == 'http://url-2.com') { | |
| //Matches YES! | |
| } else { | |
| //Matches NO! | |
| header( 'Location: http://www.url.com/no-soup-for-you/' ) ; |
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
| //Excerpt with formating from WYSIWYG | |
| function improved_trim_excerpt($text) { | |
| global $post; | |
| if ( '' == $text ) { | |
| $text = get_the_content(''); | |
| $text = apply_filters('the_content', $text); | |
| $text = str_replace('\]\]\>', ']]>', $text); | |
| $text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text); | |
| //$text = strip_tags($text, '<p>'); | |
| $excerpt_length = 70; |
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
| <h1> | |
| <?php if (is_singular('your_cpt') || is_archive('your_cpt') || is_post_type_archive('your_cpt') ) { ?> | |
| YOUR CPT NAME | |
| <?php } elseif (is_search()) { ?> | |
| Search | |
| <?php } elseif (is_404()) { ?> | |
| Error 404 | |
| <?php } else { ?> | |
| <?php the_field('headline_text'); ?> | |
| <?php } ?> |
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 remove_acf_menu() | |
| { | |
| // provide a list of usernames who can edit custom field definitions here | |
| $admins = array( | |
| 'admin', | |
| 'levy-admin', | |
| 'barb' | |
| ); |
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 | |
| $content = get_post_meta($post->ID, your_custom_field_meta, true); | |
| $trimmed_content = wp_trim_words($content, 15, '... <a href="' . get_permalink() . '">Read More</a>'); | |
| echo $trimmed_content; | |
| ?> | |
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
| // Move Yoast Meta Box to bottom | |
| function yoasttobottom() { | |
| return 'low'; | |
| } | |
| add_filter( 'wpseo_metabox_prio', 'yoasttobottom'); |
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
| /** | |
| * Hide ACF menu item from the admin menu | |
| */ | |
| function remove_acf_menu() | |
| { | |
| // provide a list of usernames who can edit custom field definitions here | |
| $admins = array( | |
| 'levy-access', |
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 echo paginate_links( $args ); ?> | |
| <!--OR--> | |
| <?php | |
| //custom paginaiton with styling from bootstrap | |
| function custom_pagination() { | |
| global $wp_query; | |
| $big = 999999999; // need an unlikely integer | |
| $pages = paginate_links( array( | |
| 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
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
| var gulp = require('gulp'); | |
| var gutil = require('gulp-util'); | |
| var sass = require('gulp-sass'); | |
| var browserSync = require('browser-sync').create(); | |
| var reload = browserSync.reload; | |
| gulp.task('sass', function () { | |
| gulp.src('./assets/styles/**/*.scss') | |
| .pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError)) |
NewerOlder