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 | |
| /* Show Custom Post Types in Gravity Form Select Field */ | |
| add_filter( 'gform_pre_render_2', 'populate_cpt_titles' ); | |
| add_filter( 'gform_pre_validation_2', 'populate_cpt_titles' ); | |
| add_filter( 'gform_pre_submission_filter_2', 'populate_cpt_titles' ); | |
| add_filter( 'gform_admin_pre_render_2', 'populate_cpt_titles' ); | |
| function populate_cpt_titles( $form ) { | |
| foreach ( $form['fields'] as &$field ) { | |
| if ( $field->type != 'select' || strpos( $field->cssClass, 'populate_cpt_titles' ) === false ) { | |
| continue; |
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 | |
| /* Register CPT */ | |
| function cwptheme_post_type() { | |
| $post_types_arr = array( 'Slider', 'Testimonial', 'Our Projects', 'Service'); | |
| foreach( $post_types_arr as $post_type_a){ | |
| $labels = array( | |
| 'name' => __( $post_type_a ), |
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 rect = $('#wrapper')[0].getBoundingClientRect(); | |
| var mouse = {x: 0, y: 0, moved: false}; | |
| $("#wrapper").mousemove(function(e) { | |
| mouse.moved = true; | |
| mouse.x = e.clientX - rect.left; | |
| mouse.y = e.clientY - rect.top; | |
| }); | |
| // Ticker event will be called on every frame |
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
| add_filter('wp_nav_menu_args', 'show_correct_main_menu'); | |
| function show_correct_main_menu($args) { | |
| if ( is_page_template( 'haspoa-page.php' ) ) { | |
| if ( $args['menu'] = '33' ) { | |
| $args['menu'] = '71'; | |
| } | |
| } | |
| return $args; | |
| } |
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 service custom fields | |
| */ | |
| function add_service_meta_boxes() { | |
| add_meta_box("service_contact_meta", "Design Numbers", "add_contact_details_service_meta_box", "services", "normal", "low"); | |
| } | |
| function add_contact_details_service_meta_box() { | |
| global $post; |
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 | |
| // taxonomy of custom post type = resources_category | |
| $terms = get_the_terms( $post->ID, 'resources_category' ); | |
| if( $terms ){ | |
| foreach( $terms as $term ){ | |
| if( $term->parent == 0 ) | |
| echo $term->term_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
| /* Custom Scripts */ | |
| function swiper_slider() { ?> | |
| <script> | |
| jQuery( document ).ready(function($) { | |
| $( ".expertise .swiper-slide" ).wrapAll( "<div class='swiper-wrapper' />"); | |
| $( ".expertise .swiper-wrapper" ).wrapAll( "<div class='swiper-container' />"); | |
| $( ".expertise .swiper-container" ).after( "<div class='swiper-button-next'></div>" ); | |
| $( ".expertise .swiper-container" ).after( "<div class='swiper-button-prev'></div>" ); |
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 | |
| /* Register Resource CPT */ | |
| add_action('init', 'create_resources_category_hierarchical_taxonomy', 0); | |
| function create_resources_category_hierarchical_taxonomy() { | |
| $labels = array( | |
| 'name' => _x('Add Resource Category', 'taxonomy general name') , | |
| 'singular_name' => _x('Resource Category', 'taxonomy singular name') , | |
| 'search_items' => __('Search Resource Category') , |
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 | |
| // $args = array( | |
| // 'public' => true, | |
| // 'labels' => $labels, | |
| // 'menu_position' => 20, | |
| // 'menu_icon' => 'dashicons-welcome-write-blog', | |
| // 'supports' => array( | |
| // 'title', | |
| // '', |
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 | |
| // change post author = admin | |
| function replace_author( $data , $postarr ) | |
| { | |
| $data['post_author'] = 1; | |
| return $data; | |
| } | |
| add_filter('wp_insert_post_data' , 'replace_author' , '99', 2); |