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 searchwp_polylang_include_only_current_language_posts( $relevantPostIds, $engine, $terms ) { | |
| if ( isset( $engine ) ) { | |
| $engine = null; | |
| } | |
| if ( isset( $terms ) ) { | |
| $terms = null; | |
| } |
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 | |
| // We could use wpml-config.xml to turn off the sync, but it wouldn't support repeater-like fields | |
| function themeprefix_dont_sync_specific_fields( $metas ) { | |
| $unsync = array( | |
| 'office_country', | |
| 'uspage_liftups_repeater' | |
| ); | |
| // Support for repeaters, flexible content fields etc. | |
| if ( is_array( $metas ) && is_array( $unsync ) ) { |
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 | |
| // Remove current post from relationship fields which refer to the same post type | |
| function remove_current_post_from_self_relationships($args, $field, $post_id) { | |
| $args['post__not_in'] = array($post_id); | |
| return $args; | |
| } | |
| $self_relationship_fields = array('relation_cases_cases'); | |
| foreach ($self_relationship_fields as $key => $field_name) { | |
| add_filter('acf/fields/relationship/query/name=' . $field_name, 'remove_current_post_from_self_relationships', 10, 3); |
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 | |
| // Hides YIKES Inc. Simple Taxonomy Ordering settings page in the admin | |
| // we don't need it because the ordering is enabled from code (tax_position => true arg for register_taxonomy) | |
| function hide_yikes_admin_page($capability_name) { | |
| return 'create_sites'; | |
| } | |
| add_filter('yikes_simple_taxonomy_ordering_capabilities', 'hide_yikes_admin_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
| <?php | |
| function polylang_display_language_code_for_object($type = 'post', $id = null) { | |
| $output = ''; | |
| if ( function_exists('pll_get_post_language') && function_exists('pll_get_term_language') ) { | |
| // language slug | |
| $slug = ''; |
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 | |
| function my_add_blog_archive_admin_menu() { | |
| // $page_title, $menu_title, $capability, $menu_slug, $callback_function | |
| add_posts_page( | |
| __( 'Edit Archive Page', 'mysite' ), | |
| __( 'Edit Archive Page', 'mysite' ), | |
| 'read', | |
| add_query_arg( | |
| array( |
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 | |
| function prevent_pages_deletion( $allcaps, $caps, $args ) { | |
| $pages_ids = array( | |
| get_option( 'page_for_posts' ), | |
| get_option( 'page_on_front' ), | |
| ); | |
| // if using Polylang — don't forget to include specific language slug when using pll_get_post() to get the page id. Without it the function doesn't work in admin | |
| // pll_get_post( get_option( 'page_for_posts' ), 'ru' ), |
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 | |
| // can be in functions.php as well | |
| acf_add_local_field_group(array ( | |
| 'key' => 'group_59b665d4365e1', | |
| 'title' => 'Tracking codes', | |
| 'fields' => array ( | |
| array ( | |
| 'key' => 'field_59b666088db92', | |
| 'label' => __('Tracking code (header)','theme_domain'), |
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 themeprefix_save_gf_upload_to_acf_image($entry, $form) { | |
| // If the ID of the form being saved isn't the one we're looking for, bail. | |
| $forms_with_class = themeprefix_get_form_ids_by_form_class('edit-profile'); | |
| if ( $forms_with_class[0] != $entry['form_id']) { | |
| return; | |
| } | |
| // If we don't have the ID of the user, bail. | |
| if (!isset($entry['created_by'])) { |