Adding regular php file to site

You could accomplish this by setting up a redirect. If you’re using an Apache server, for your example, you would add this to .htaccess above the WordPress block: RewriteEngine On RewriteRule somepost.php ^/somepost/ It’s much more common, and recommended, to create a PHP file and a Page (or other post type) within wp-admin). This will … Read more

dynamic_sidebar() stopped working

In a case like this, you’re probably going to need to check the conditions in dynamic_sidebar to find out what is not happening. if (isset($_GET[‘debugsidebar’])) {add_action(‘init’, ‘debug_sidebar’);} function debug_sidebar() { $id = $_GET[‘debugsidebar’]; $sidebarswidgets = get_option(‘sidebars_widgets’); if (is_active_sidebar($id)) {$status = ” Active”;} else {$status = “Inactive”;} echo “Sidebar ID: “.$id.” (“.$status.”)<br>”; if (array_key_exists($id, $sidebarswidgets)) { … Read more

is_page_template showing partial results

The is_page_template() function is for checking if the current page is using a specific custom page template. That being a template selected from the Template dropdown in the Page Attributes box when editing the page. The WordPress conditional tags are not based around which template files are used. They are used to tell you what … Read more

How do I remove the word “Blog” from a WordPress Homepage?

The file where you could delete the text is index.php This is the line containing the text, so you could remove this line. <h2 class=”section-title”><?php echo esc_html__( ‘Blog’, ‘catch-vogue’ ); ?></h2> For future reference, if you were to update the theme at a later date when an update becomes available from the theme author, the … Read more

Create template for just a print

You can add a custom CSS via the customizer (or via code). Chrome can also show you what your site will look like in print mode (see links at the bottom). Something like the following would generate a nice page for printing: @media print{ #custom-header{ background:#fff; } #custom-header > img, a.scrollup, a.scrollup:visited, .wp-travel-related-posts, #footer-widgets{ display:none … Read more

Why aren’t some plugin styles loading when I load a template?

According to the WordPress Codex, using template_redirect to load a different template is discouraged and can cause certain code to not be executed, which of course can result in strange bugs. template_include is the more appropriate solution. It loads a template file but without the behavior mentioned above. add_action( ‘template_include’, function($original_template) { if (is_singular(‘business’)) { … Read more

Pages from custom table

Your code worked absolutely fine for me, so I suspected you forgot to flush the rewrite rules. Each time after you added code which alters the WordPress rewrite rules, e.g. add_rewrite_rule() or code which registers/un-registers a CPT or custom taxonomy with URL rewriting enabled, you should always flush the rewrite rules which means WordPress will … Read more