Tagged: ,

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1356168

    Hi,

    Would it be possible to make the header row sortable? See link for example table.

    #1356236

    Hi bonsaimedia,

    Yes, it’s possible however, you’ll need to use a child theme first, if you have already have a child theme, skip this step:
    You can download and find instructions for it here: https://kriesi.at/documentation/enfold/child-theme/
    Make sure to follow the 4 steps under Install a child theme from your WordPress dashboard.

    Once you have installed and activated the child theme, do the following steps:
    1. Add this code in your child theme’s functions.php file (if you already have a child theme, and already had this code do not add it):

    /**
     *	Add filter to add or replace Enfold ALB shortcodes with new folder contents
     *	
     *	Note that the shortcodes must be in the same format as those in 
     *	enfold/config-templatebuilder/avia-shortcodes
     *
     *	@link http://kriesi.at/documentation/enfold/add-new-or-replace-advanced-layout-builder-elements-from-child-theme/
     * 
     * @param array $paths
     * @return array
     */
    function avia_include_shortcode_template( $paths )
    {
    	if( ! is_array( $paths ) )
    	{
    		$paths = array();
    	}
    	
    	$template_url = get_stylesheet_directory();
    	array_unshift( $paths, $template_url . '/shortcodes/' );
    
    	return $paths;
    }
    
    add_filter( 'avia_load_shortcodes', 'avia_include_shortcode_template', 15, 1 );

    2. Go to wp-content/enfold/config-templatebuilder/avia-shortcodes/ and copy the table folder, then go to the child theme and create a new folder and name it shortcodes and paste the table folder inside it. Inside the table folder, edit table.php and go to line 486 (this is the code on that line):

    'avia-data-table',

    below it, add this code:

    'sortable',

    3. Download this file https://www.kryogenix.org/code/browser/sorttable/sorttable.js and in your child theme, create another folder called js, inside it upload the file you just downloaded.

    4. Then in your child theme’s functions.php, add this code:

    function add_sorttablejs() {
        wp_enqueue_script( 'kryogenix-sorttable', get_stylesheet_directory_uri().'/js/sorttable.js', array('jquery'), 2, true );
    }
    add_action( 'wp_enqueue_scripts', 'add_sorttablejs', 100 );

    Hope this helps.
    If you need assistance, just let us know.

    Best regards,
    Nikko

    #1356253

    Hi Nikko,

    Thanks for your reply. Yes, we always use childs (offcourcse ;-)).
    I will try this!

    Best regards

    #1356283

    Hi bonsaimedia,

    You’re welcome :)
    Just let us know how it goes.

    Best regards,
    Nikko

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.