PHP code example of alleyinteractive / archiveless
1. Go to this page and download the library: Download alleyinteractive/archiveless 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/ */
alleyinteractive / archiveless example snippets
$query = new WP_Query(
[
'exclude_archiveless' => true,
// ...
]
);
// Via 'pre_get_posts'.
add_action(
'pre_get_posts',
function ( $query ) {
if ( special_condition() ) {
$query->set( 'exclude_archiveless', true );
}
}
);