How do I get the page template name chosen?

I picked the following code from an answer here, https://stackoverflow.com/questions/2544870/remove-main-editor-from-wordpress-edit-page-screen/42093956. I tweaked the code to remove the classic editor on pages using default page template. And added the comments. function remove_editor_init() { $post_id = 0; if ( isset( $_GET[‘post’] ) ) { $post_id = $_GET[‘post’]; } $template_file = get_post_meta( $post_id, ‘_wp_page_template’, TRUE ); // var_dump($template_file) … Read more

Is there a more efficient way to loop through pages?

Alternative to if… else… you can use the control structure switch functionality. But if you use if… elseif… or switch is mainly a matter of preference. The performance is the same. if else if ($i == 0) { echo “i equals 0”; } elseif ($i == 1) { echo “i equals 1”; } elseif ($i … Read more

Two exact templates, sidebar showing in one but not the other

Look at the config.php: function roots_display_sidebar() { $sidebar_config = new Roots_Sidebar( /** * Conditional tag checks (http://codex.wordpress.org/Conditional_Tags) * Any of these conditional tags that return true won’t show the sidebar */ array( ‘is_404’, ‘is_front_page’ ), /** * Page template checks (via is_page_template()) * Any of these page templates that return true won’t show the sidebar … Read more

lost css when overriding themes templates

Without seeing the code, I would guess that your main stylesheet is being loaded by get_stylesheet_directory_uri() or something of that nature. Now that you’ve copied header.php into your child theme get_stylesheet_directory_uri() is looking in YOUR theme for that stylesheet. It isn’t there and thus you have no CSS. Change the stylesheet directory to get_template_directory_uri() and … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)