PHP code example of mindkomm / theme-lib-onepager

1. Go to this page and download the library: Download mindkomm/theme-lib-onepager library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mindkomm / theme-lib-onepager example snippets


$onepager = new Theme\Onepager\Onepager();
$onepager->init();

/**
 * Do not apply Onepager link filtering for WooCommerce pages.
 *
 * @param bool   $bailout Whether to bail out early.
 * @param string $link    The link to filter.
 * @param string $post_id The ID of the post to filter the link for.
 *
 * @return bool
 */
add_filter( 'theme/onepager/apply_link_filter', function( $bailout, $link, $post_id ) {
    if ( wc_get_page_id( 'shop' ) === $post_id || wc_get_page_id( 'checkout' ) === $post_id ) {
        return true;
    }
    
    return $bailout;
}, 10, 3 );