How to display error on specific template?

@PieterGoosen gave some good advice. Focus on that, But if you really wan it, then you can set debug ON temporarily on your website this way. In your wp-config.php use this instead. if ( isset( $_GET[‘debug’] ) && ‘debug’ == $_GET[‘debug’] ) { define( ‘WP_DEBUG’, true ); } Then access your website homepage/any page and … Read more

Change directory where get_header(), get_footer() and get_sidebar() look for templates

Simple solution, use get_template_part(). For example: get_template_part( ‘partials/footer’ ); Which would get the footer.php inside the partials/ directory. Another example: get_template_part( ‘partials/footer’, ‘home’ ); Which would get the footer-home.php inside the partials/ directory. One more example: get_template_part( ‘partials/footer/blog’ ); Which would get the blog.php inside the partials/footer/ directory.

Load template file without a post type

You could setup a custom rewrite rule using add_rewrite_rule and send these requests to a custom page. Your URL structure could be /index-page/single-event-slug The rule would point all of the single events to a separate page where you can then set your template events-single.php. Another option is to pass the events in as a query … Read more

Child theme TEMPLATEPATH issue

In your context you use the wrong constant. You must use the constant STYLESHEETPATH for the path to the active child theme. The constant TEMPLATEPATHget the path to the parent theme, that was referenced in the child theme. But, a important hint. The constant is deprecated, see the ticket #18298 for more information. That’s is … Read more

Adding variable to get_template_part

It looks like you’re just trying to concatenate a string, so it can be done like this: <?php get_template_part( ‘template-parts/component-page/component-‘ . $variable ); ?> Or you could use string interpolation (note the double quotes used here): <?php get_template_part( “template-parts/component-page/component-{$variable}” ); ?> Alternatively, get_template_part() can take two parameters, $slug and $name: <?php get_template_part( ‘template-parts/component-page/component’, $variable ); … Read more

Show template loaded

The following will show the current template file to logged in admins only. If you add to the top of your functions file, you should see this info as the first line. add_action(‘wp_head’, ‘show_template’); function show_template() { global $template; global $current_user; get_currentuserinfo(); if ($current_user->user_level == 10 ) print_r($template); } You will still need to follow … Read more

Why aren’t my posts showing?

This doesn’t work the way you think it does because get_pages doesn’t do what you think it does. First, understand that all pages, all content, in WordPress is really a “post”. A “Page” is just a special type of post. Now, in a normal environment, you wouldn’t call “get_” anything. This is why you’re confused, … Read more

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