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 | |
| /* | |
| Plugin Name: GF file upload to ACF image field | |
| Plugin URI: https://gist.github.com/certainlyakey/8c19791b3133beb62d323bf060bf4270 | |
| Description: Map Gravity forms file upload field to ACF image/file field so GF would upload the file and save id to DB instead of URL. | |
| Version: 1.0.0 | |
| Author: Kellen Mace | |
| */ |
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
| //Insert profile link into trail on create diary page | |
| function theme_add_to_trail_on_create_diary_entry($trail) { | |
| if (is_page_template('custom-template.php')) { | |
| $home = $trail->breadcrumbs[0]; | |
| $current_page = $trail->breadcrumbs[1]; | |
| $profile = new bcn_breadcrumb(__('Profile','domain'), NULL, array('c-breadcrumbs__item'), get_author_posts_url(get_current_user_id())); | |
| // $trail->add($profile) always inserts in the beginning | |
| $trail->breadcrumbs = array($home, $profile, $current_page); |
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
| if (function_exists('bcn_display')) { | |
| function theme_remove_news_from_trail_on_404($trail) { | |
| if ( is_404() ) { | |
| unset($trail->trail[1]); | |
| array_keys($trail->trail); | |
| } | |
| } | |
| add_action('bcn_after_fill', 'theme_remove_news_from_trail_on_404'); | |
| } |
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
| acf_add_local_field_group(array ( | |
| 'key' => 'group_ujq7wrdtwyldi', | |
| 'title' => __('System settings','domain'), | |
| 'fields' => array ( | |
| array ( | |
| 'key' => 'field_sf9o6xmozloau', | |
| 'label' => __('Hide this page for non admins?','domain'), | |
| 'name' => 'page_is_system', | |
| 'type' => 'true_false', | |
| 'instructions' => '', |
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
| // @z-index space: 100-110 | |
| .c-header { | |
| $local-spacing-top:10px; | |
| @include t-page-wrapper; | |
| padding-top:$local-spacing-top; | |
| display:flex; | |
| &__logo { | |
| @include mq($until: mainmenu-horizontalized) { |
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
| <? | |
| // Limit upload size | |
| function themeprefix_limit_upload_size($file) { | |
| $img = getimagesize($file['tmp_name']); | |
| $minimum = themeprefix_get_minimum_width_height_of_all_sizes(); | |
| $width = $img[0]; | |
| $height = $img[1]; | |
| if ($width < $minimum['width'] ) { |
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
| <? | |
| // From https://wp-snippet.com/snippets/remove-author-prefix-from-slug/ | |
| add_filter('author_rewrite_rules', 'no_author_base_rewrite_rules'); | |
| function no_author_base_rewrite_rules($author_rewrite) { | |
| global $wpdb; | |
| $author_rewrite = array(); | |
| $authors = $wpdb->get_results("SELECT user_nicename AS nicename from $wpdb->users"); | |
| foreach($authors as $author) { | |
| $author_rewrite["({$author->nicename})/page/?([0-9]+)/?$"] = 'index.php?author_name=$matches[1]&paged=$matches[2]'; | |
| $author_rewrite["({$author->nicename})/?$"] = 'index.php?author_name=$matches[1]'; |
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 | |
| // Hide certain pages (ones with system-page category assigned) from the general admin listing, but keep them accessible when visiting category listing in admin | |
| function hide_system_pages($query) { | |
| if ( | |
| is_admin() && | |
| !empty( $_GET['post_type'] ) && | |
| $_GET['post_type'] == 'page' && | |
| !$_GET['category_name'] && | |
| $query->query['post_type'] == 'page' |
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
| // Get ids of forms with a certain class | |
| function themeprefix_get_form_ids_by_form_class($class) { | |
| $form_ids = array(); | |
| $all_forms = GFAPI::get_forms(); | |
| foreach ($all_forms as $form) { | |
| if (isset($form['cssClass'])) { | |
| $form_classes = explode(' ', $form['cssClass']); | |
| if (in_array($class, $form_classes)) { | |
| $form_ids[] = $form['id']; |
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
| // @include u-responsive-value(margin-top, (small:18px, medium:25px, large:29px, xlarge:40px)); | |
| // dependencies: sass-mq (can be replaced with a simple map of named media queries) | |
| @mixin u-responsive-value($property, $values-map) { | |
| @if type-of($values-map) == 'map' { | |
| @each $mq, $value in $values-map { | |
| @if map-has-key($mq-breakpoints, $mq) { | |
| @if $mq == small { | |
| #{$property}:$value; | |
| } @else { | |
| @include mq($from: $mq) { |