PHP code example of voceconnect / select-posts-widget

1. Go to this page and download the library: Download voceconnect/select-posts-widget 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/ */

    

voceconnect / select-posts-widget example snippets


        add_filter( 'spw_template', 'customize_spw_template_filter' );
        function customize_spw_template_filter( $template ){
            $template_dir = get_template_directory();
            return $template_dir . '/views/custom-spw.php';
        }
    

        add_filter( 'spw_select_posts_widget-15_template', 'customize_spw_post_types' );
        function customize_spw_post_types($post_types){
            $post_types = array( 'post', 'page' 'custom_post_type' );
            return $post_types;
        }