Automatically generate pages from SQL

Use a shell script and WP-CLI in your SSH console. Your shell script has to fetch each element of your table and launch the function of WP-CLI that creates a post in WordPress. You can even provide a sort of template in the call of the function. WP-CLI is a useful tool, but you can … Read more

How to rewrite a page url

You can change page URL from the page editor. If you want to make changes for all the pages. You can go to settings -> general settings -> permalink and change it to your desired value. To change for a single page, modify your .htaccess : <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f … Read more

PHP Output also in Child theme, but different

You need to make the function pluggable, that means, to support child themes, the functions in parent theme should use: if ( !function_exists( ‘function_name’ )) { function function_name() { //Stuffs } } You should have seen a PHP Error message if you have debugging enabled. EDIT: The below code snippet if to answer your other … Read more

Having pages after specifying post_type post

Your cat_n_tag_archives() function is adding pages to all category and tag results indiscriminately. What you probably want (and I am guessing a little) is to restrict that filter to the main query only: function cat_n_tag_archives($wp_query) { if (!$wp_query->is_main_query()) return; // This bit checks for the main query $ary_one = array(‘post’, ‘page’); if ($wp_query->get(‘category_name’) || $wp_query->get(‘cat’)) … Read more

Using page-something.php as static front page

Use ‘front-page.php’ for your template. You can read more about it at https://codex.wordpress.org/Creating_a_Static_Front_Page Or create a page template that you set in the editor. This will allow you to set it on any page and you’re not tied to the ID. https://developer.wordpress.org/themes/template-files-section/page-template-files/page-templates/ <?php /* Template Name: Example Template */ ?>

Dynamic page with comments

You probably can hack comments in somehow, but don’t. Create a custom post type for your musicians using register_post_type() and including “comments” support. You can then create post type templates to customize the display: archive-{post_type}.php — for archives single-{post_type}.php — and for single posts https://codex.wordpress.org/Post_Type_Templates Comments should now work properly without your having to hack … Read more