How to start a script from cli within wordpress

Xaedes solution in https://wordpress.stackexchange.com/a/76466/107596 works quite well: <?php if( php_sapi_name() !== ‘cli’ ) { die(“Meant to be run from command line”); } function find_wordpress_base_path() { $dir = dirname(__FILE__); do { //it is possible to check for other files here if( file_exists($dir.”/wp-config.php”) ) { return $dir; } } while( $dir = realpath(“$dir/..”) ); return null; } … Read more

My Styles are not registering

There can be multiple reasons why it may not be working. Possibility-1: You are adding the CSS file in a child theme. In that case, use the following CODE instead: function theme_styles_and_scripts() { wp_enqueue_style( ‘bootstrap’, get_stylesheet_directory_uri() . ‘/css/bootstrap.min.css’, array(), ‘3.3.6’, ‘all’ ); } add_action( ‘wp_enqueue_scripts’, ‘theme_styles_and_scripts’ ); get_stylesheet_directory_uri() returns the URL of your current theme … Read more

Can’t increase posts_per_page by variable

All right, I think I see what’s going on… As per WP pagination parameters documentation, posts_per_page is indeed cached. Somewhat… Basically, you could set this to “10” the first time, as you do, and then to 5 after that, but then use “offset” or “paged” parameters to get the posts you want. Your “load-next-amount” variable … Read more