Part of content hidden

Accordion section, on click, scrolling at the top, hiding part of the content.

  • Ash

    Hello allanlove

    Please add the following code:

    add_action( 'wp_head', function() {
    	?>
    	<script>
    		jQuery(function($){
    			$('.ui-accordion-header').click(function(){
    				var __this = $(this);
    				setTimeout(function(){
    					$('html, body').animate({
    						scrollTop: __this.next('div').offset().top - 300
    					}, 200);
    				}, 500);
    			});
    		});
    	</script>
    	<?php
    } );

    You can use this code in your child theme's functions.php if the theme is not changed. Otherwise mu-plugin is the best option. To create a mu-plugin, go to wp-content/mu-plugins folder. If there is no mu-plugins folder then, create one. Now, inside the mu-plugins folder create file with name anything.php (make sure file extension is .php). Now start with a <?php tag and then put the above code.

    Hope it helps! Please feel free to ask more questions if you have any.

    Have a nice day!

    Cheers,
    Ash

  • allanlove

    Hey,

    the attached is the functions.php which is from the child theme of this site - I have tried using this code but it didn't seem to work it just made an error - I was wondering if you could place it where it needs to be?

    <?php
    // Exit if accessed directly
    if ( !defined( 'ABSPATH' ) ) exit;
    
    // BEGIN ENQUEUE PARENT ACTION
    // AUTO GENERATED - Do not modify or remove comment markers above or below:
    
    if ( !function_exists( 'chld_thm_cfg_parent_css' ) ):
        function chld_thm_cfg_parent_css() {
            wp_enqueue_style( 'chld_thm_cfg_parent', trailingslashit( get_template_directory_uri() ) . 'style.css', array( 'font-awesome' ), date_timestamp_get(date_create()));
        }
    endif;
    add_action( 'wp_enqueue_scripts', 'chld_thm_cfg_parent_css', 10 );
    
    // END ENQUEUE PARENT ACTION
    
    function get_to_map_search() { ?>
    <script type="text/javascript">
    
    jQuery(document).ready(function( $ ){
    $('body').on('wpgooglemaps_loaded', '.wpgmza_map', function(){
    var $_GET = {};
    var map_id = parseInt($(this).attr('id').replace('wpgmza_map_',''));
    if(document.location.toString().indexOf('?') !== -1) {
    var query = document.location
    .toString()
    // get the query string
    .replace(/^.*?\?/, '')
    // and remove any existing hash string (thanks, @vrijdenker)
    .replace(/#.*$/, '')
    .split('&');
    
    for(var i=0, l=query.length; i<l; i++) {
    var aux = decodeURIComponent(query[i]).split('=');
    $_GET[aux[0]] = aux[1];
    }
    if ('distance' in $_GET){
    $('#radiusSelect_'+map_id).val($_GET['distance']);
    }
    if ('address' in $_GET){
    $('#addressInput_'+map_id).val($_GET['address']);
    $('.wpgmza_sl_search_button_'+map_id).click();
    }
    }
    });
    });
    
    </script>
    
    <?php }
    add_action( 'wp_footer', 'get_to_map_search');
    
    wp_dequeue_style( 'chld_thm_cfg_parent' );
    
    function my_files_only( $wp_query ) {
        if ( strpos( $_SERVER[ 'REQUEST_URI' ], '/wp-admin/upload.php' ) !== false ) {
            if ( !current_user_can( 'level_3' ) ) {
                global $current_user;
                $wp_query->set( 'editor', $current_user->id );
            }
        }
    }
    add_filter('parse_query', 'my_files_only' );
    
    add_action('pre_get_posts','users_own_attachments');
    function users_own_attachments( $wp_query_obj ) {
    
        global $current_user, $pagenow;
    
        $is_attachment_request = ($wp_query_obj->get('post_type')=='attachment');
    
        if( !$is_attachment_request )
            return;
    
        if( !is_a( $current_user, 'WP_User') )
            return;
    
        if( !in_array( $pagenow, array( 'upload.php', 'admin-ajax.php' ) ) )
            return;
    
        if( ! current_user_can('administrator') )
            $wp_query_obj->set('author', $current_user->ID );
    
        return;
    }
    
    add_action( 'get_previous_post_where', 'change_post_types_of_pagination', 20 );
    add_action( 'get_next_post_where', 'change_post_types_of_pagination', 20 );
    
    function change_post_types_of_pagination( $where ){
    return str_replace(
    array( "p.post_type = 'post'", "p.post_type = 'events'", "p.post_type = 'vacancies'", "p.post_type = 'closures'", "p.post_type = 'news'"),
    "(p.post_type = 'post' OR p.post_type = 'events' OR p.post_type = 'vacancies' OR p.post_type = 'closures' OR p.post_type = 'news')",
    $where
    );
    }
    
    add_filter( 'body_class','tumbletod_body_class' );
    function tumbletod_body_class( $classes ) {
    
    $tumbletod_custom_type = get_post_type();
    
    if ( is_singular( )) {
    $classes[] = $tumbletod_custom_type;
    }
    
    return $classes;
    
    }
    
    add_action( 'wp_head', function() {
            add_shortcode( 'social-media-icons_', 'social_media_icons_shortcode_' );
    
            function social_media_icons_shortcode_ () {
                $icons = '<div class="right-content mobile_social_menu" style="margin:0 auto">';
                $icons .= wp_nav_menu(
                            array(
                                'theme_location' => 'social',
                                'menu_class' => 'social-menu',
                                'fallback_cb' => false,
                                'link_before' => '<span class="screen-reader-text">',
                                'link_after' => '</span>',
                                'echo' => false,
                                'depth' => 0
                             )
                        );
                $icons .= '</div>';
    
                return $icons;
            }
    
    ?>
    <script type="text/javascript">
    jQuery(function($){
        // Get the height of the header
        var headerHeight = $("#masthead").outerHeight();
    
        if (window.location.hash.trim() !== "") {
            var target = window.location.hash; //Get the target
            var scrollToPosition = $(target).offset().top - headerHeight - 75;
    
            $('html').animate({ 'scrollTop': scrollToPosition });
        }
    
        // Attach the click event
        $('a[href*=#]').bind("click", function(e) {
            var target = $(this).attr("href"); //Get the target
            var scrollToPosition = $(target).offset().top - headerHeight - 75;
    
            $('html').animate({ 'scrollTop': scrollToPosition }, 600, function(){
                window.location.hash = target;
            });
    
            e.preventDefault();
        });
    });
    </script>
    </script>
    
    <script>
    jQuery(function() {
    function leave_now(event) {
    var choice = window.confirm( 'You are now leaving Tumble Tots, do you wish to continue?' );
    return choice;
    }
    
    var select_external = 'a[href*="//"]:not([href*="allanlove.net"])';
    jQuery(document).on( 'click', select_external, leave_now )
    });
    </script>
    <?php
    } );

    `

    Regards
    A

  • Ash

    Hello allanlove

    Would you please send me your admin login and cPanel details?

    You can send me privately in the following format:
    1. Please go to https://premium.wpmudev.org/contact/#i-have-a-different-question
    2. Select "I have a different question" if not selected
    3. In subject line put "Attn-Ash" (this will ensure that the email is assigned to me)
    4. Provide the wanted details.
    5. Add the thread link in the message so that I can track.

    Have a nice day!

    Cheers,
    Ash

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.