I found the problem here (line 103 of function.php):
if ( is_single() && 'qa_faqs' == get_post_type($post) ) {
if ( file_exists( TEMPLATEPATH . '/single-qa_faqs.php') ) {
$page_template = TEMPLATEPATH . '/single-qa_faqs.php';
} elseif ( file_exists( TEMPLATEPATH . '/page.php') ) {
$page_template = TEMPLATEPATH . '/page.php';
} elseif ( file_exists( TEMPLATEPATH . '/single.php' )) {
$page_template = TEMPLATEPATH . '/single.php';
} else {
$page_template = TEMPLATEPATH . '/index.php';
}
}
That TEMPLATEPATH constant is only going to work on themes that are parent themes. This is a big problem for anyone using theme frameworks such as Genesis.
https://www.ads-software.com/plugins/q-and-a/
]]>I got this error message unexpectedly while running the Launch Effect theme on a otherwise default WordPress installation every time I tried to submit the contact form.
Now I would have blamed the theme, but tried to trace the error. Going through the code file by file with a die('here')
I finally ended up on lines 198-200 in wp-settings.php:
foreach ( wp_get_active_and_valid_plugins() as $plugin )
include_once( $plugin );
unset( $plugin );
Trying to make sure this was the line causing the error, I put a simple echo('here');
before and after the block. Turns out the first is displayed, the second not.
So, to investigate which plugin broke the blog, I added a line for debug output:
foreach ( wp_get_active_and_valid_plugins() as $plugin )
print($plugin);
include_once( $plugin );
unset( $plugin );
Much to my surprise, the file now worked. The fatal error was gone. So, in an attempt of utter irritation, I re-wrote the line to this:
foreach ( wp_get_active_and_valid_plugins() as $plugin )
(function(){});
include_once( $plugin );
unset( $plugin );
… and now everything works just fine.
Does anyone have any idea what the heck is going on here? I am very, very confused
]]>I installed a brand new WordPress 3.5.1 web site. I installed the Green Grunge Theme version 1. I created a folder wp-content/themes/green-grunge-theme-child. I created the style.css sheet:
/*
Theme Name: Green Grunge Child
Description: Child theme for the Green Grunge theme
Template: green-grunge-theme
Version: 0.1.0
*/
@import url("../green-grunge-theme/style.css");
When I activated the child theme I got a blank page. So I turned on php error reporting in .htaccess:
# Displaying PHP errors
php_flag display_errors on
This gave me the error:
Warning: require_once(/Volumes/MediaAssets/com.fbcmabank/wordpress/wp-content/themes/green-grunge-church-theme-child/extensions/event-post-type.php): failed to open stream: No such file or directory in /Volumes/MediaAssets/com.fbcmabank/wordpress/wp-content/themes/green-grunge-church-theme/functions.php on line 400 Fatal error: require_once(): Failed opening required '/Volumes/MediaAssets/com.fbcmabank/wordpress/wp-content/themes/green-grunge-church-theme-child/extensions/event-post-type.php' (include_path='.:') in /Volumes/MediaAssets/com.fbcmabank/wordpress/wp-content/themes/green-grunge-church-theme/functions.php on line 400
This was the most helpful page during my research:
https://www.ads-software.com/support/topic/theme-desire-child-theme-bug-fix
which says change get_stylesheet_directory()
to get_template_directory()
in the functions.php file.
However, Green Grunge has the variable STYLESHEETPATH
instead of the function get_stylesheet_directory(). Fortunately, there is something called TEMPLATEPATH
also in the Green Grunge functions.php file. Thus the solution is to change STYLESHEETPATH
to TEMPLATEPATH
.
Change:
require_once(STYLESHEETPATH . '/extensions/event-post-type.php');
to:
require_once(TEMPLATEPATH . '/extensions/event-post-type.php');
Rob
]]>I use template_redirect to redirect 404 requests to a custom template file (products.php):
add_filter('template_redirect', 'mp_404_filter_override' );
function mp_404_filter_override() {
global $wp_query;
if(<SOME BUSINESS LOGIC>)
{
status_header( 200 );
$wp_query->is_404=false;
include (TEMPLATEPATH . '/products.php');
exit;
}
}
No problems redirecting the users. They all end up on products.php as they should.
The problem is that products.php keeps reloading since the template_redirect filter I have set up is checked again and again.
Any ideas on how I can stop products.php from reloading?
Thanks,
Mads
I have the following defined in my functions.php
define('TEMPLATEPATH', get_template_directory());
I am then later in the file attempting to enqueue some files:
// Enqueue Scripts
function bluehive_scripts() {
wp_enqueue_style( 'style', get_stylesheet_uri() );
wp_enqueue_script( 'bootstrap-script', TEMPLATEPATH . '/lib/bootstrap/js/bootstrap.js' );
}
add_action( 'wp_enqueue_scripts', 'bluehive_scripts' );
When I go to view the page source to see if bootstrap.js is being included in the <head> its showing up as:
<script src="https://localhost:8081/bluehiveC:wampwwwbluehive/wp-content/themes/bluehivepress/lib/bootstrap/js/bootstrap.js?ver=1" type="text/javascript"></script>
Why is it showing https://localhost:8081/bluehiveC:wampwwwbluehive ?
It should be showing as:
https://localhost:8081/bluehive/wp-content/themes/bluehivepress/lib/bootstrap/js/bootstrap.js?ver=1
Thanks for your assistance,
Chad
]]>The error message:
Warning: dir(TEMPLATEPATH/) [function.dir]: failed to open dir: No such file or directory in /home/content/26/9196326/html/wp-includes/functions.php on line 100
Fatal error: Call to a member function read() on a non-object in /home/content/26/9196326/html/wp-includes/functions.php on line 101
Here is the section of code it is trying to execute:
/*
Get Available CSS
*/
function get_availableCss(){
$result = array();
$dir = dir(TEMPLATEPATH.”/”); (This is line 100)
while (false !== ($file = $dir->read())) {
if(ereg(“\.css”, $file, $r)){
$result[] = $file;
}
}
$dir->close();
return $result;
}
The TEMPLATEPATH displayed in the error msg appears to be wrong but I can’t seem to figure out how to fix it.
Any help would be GREATLY appreciated!
Dan
[ Duplicate https://www.ads-software.com/support/topic/how-to-edit-templatepath?replies=1 – Closing. Please continue with the original topic. ]
]]>Ex 1: get_template_directory()
load_theme_textdomain('my_theme', get_template_directory() . '/languages');
Ex 2: TEMPLATEPATH
load_theme_textdomain( 'my_theme', TEMPLATEPATH . '/languages' );
So… if two calls return the same path, what is the difference? I’ve read a couple posts from Google hinting at a possible connection to child theme/main theme relationships. Should I use one in main themes and another in child themes? What are the best practices?
]]>Can’t I just use bloginfo(‘wpurl’); instead?
]]><?php include (TEMPLATEPATH . "/includes/customfields.php"); // get the custom field variables ?>
<?php get_template_part( 'includes/customfields' ); ?>
What I have is an include file: page-headers.php which used the include TEMPLATEPATH to get another file that contains only custom fields I created to add a page header with an image overlay title, caption, button, etc. But for the first time, I am discovering the TEMPLATEPATH works but if I change it to the get_template_part, it doesn’t work. I also just directly added the custom field variables directly in this page-headers.php file and it worked too, but why would the get template part not work this time around?
Thanks in advance.
]]>I was setting up few variables, relative to the path of php and js files, and I realized that I had to use different gergo, for different things. For instance:
$styles_path = get_bloginfo('template_directory') . '/library/styles/';
$theme_path = TEMPLATEPATH . '/library/theme/';
I looked into this forum for an explanation about why sometimes I have to use TEMPLATEPATH and others get_bloginfo(‘template_directory’), but I could not find any posts on the topic.
Does anyone know the difference between the two?
Thanks in advance, ciao!
Carlo