How to add template to theme in WP

WordPress does not allow adding files though the admin side of things, therefore you will need FTP or SSH access to the server to add a file to your theme directory at least to initially add the template then you can edit it though your hearts content in the admin. (there may be a plugin … Read more

How to mark an option as selected

What you are looking for is the selected() function. Your updated option should look like this: <option value=”<?php echo $category->cat_ID; ?>” <?php selected($option, $category->cat_ID); ?>> <?php echo $category->cat_name; ?> </option> // EDIT Oh, and BTW, in your particular case you might want to use the wp_dropdown_categories function, I guess. That would be: wp_dropdown_categories( array( ‘selected’ … Read more

WordPress AJAX in header.php

There are tons of questions about using Ajax, so your question could be easily marked as duplicated but I see so BIG mistakes that I can’t say to you that the question is duplicated without explaining your mistakes. The Ajax in WordPress is handled in admin-ajax.php file, wehre you correctly sent the ajax request (see … Read more

Extra themes – ok or bad?

Any extra code on your server is a theoretical security risk. Instead of checking each plugin and theme if they are security risk even if they are not active, it is much easier to just delete them. This of course should not prevent you from backuping them first in case you will decide that you … Read more

WordPress Fatal error: Call to undefined get_header() in index.php on line 15 [closed]

Something went wrong with your installation. As commented by @Sumit get_header() is a core function and cannot be undefined. To troubleshoot: Reinstall WordPress and enable WP_DEBUG in wp_config.php: define( ‘WP_DEBUG’, true ); If it is on a live site you might want to use this instead: define( ‘WP_DEBUG_LOG’, true ); define( ‘WP_DEBUG_DISPLAY’, false ); This … Read more

Activate a new WordPress Theme Only for Admins

At first, you should active the WordPress Debug mode to get the error after implement your code. The code should work, also tested on my environment. I use it on a client installation and works really well. See my source below. It is important that you use the right string for the theme slug, like … Read more