I have a site in development that seems to be spitting out my template directory from wp_head. It's driving me crazy.
I inherited this site and I'm trying to make it work. I don't know what I should be looking for in the files.
here's the site in question: http://discoverthebody.ca/test/
Can anyone help with what I should look for?
EDIT: To clarify, in my header.php, I've narrowed down the error to happening here:
<!-- wordpress head functions -->
<?php wp_head(); ?>
<!-- end of wordpress head -->
The stray template directory call is being output right after that comment, so I assume wp_head() is where it's happening.
I'm not entirely sure what is it. I happened to notice that you have the plugin woo e-commerce enabled. I've noticed that plugin has really gone downhill lately, and tends to do a bunch of random stuff as well as not even work. Try disabling that plugin and seeing if it helps.
If it doesn't, try disabling your plugins one-by-one. If that doesn't fix it, look in header.php in your theme directory. for a stray link in the HTML.
if I was in your shoes I would do a site-wide search (ie grep) for one of these:
bloginfo( 'template_directory );
bloginfo( 'stylesheet_directory' );
get_stylesheet_directory_uri()
get_template_directory_uri()
TEMPLATEPATH
see: http://codex.wordpress.org/Function_Reference/bloginfo
Related
In the theme check of my website I saw an error saying that the filter body_class was not found. I took a look at the support page of the plugin I´m using (https://support.fancyproductdesigner.com/support/solutions/articles/5000582912-using-the-debug-mode-to-inspect-any-missing-hooks-in-woocommerce-product-pages) and it says:
Missing hook: body_class
If you are seeing this information instead of the Product Designer:
Sorry! But the product designer is not adapted for your device. Please use a device with a larger screen!
It means an important hook is missing in your theme. You need to add following code to the body HTML tag in the header.php your theme.
<body <?php body_class(); ?>>
I tried to add the code to the header.php file, which has this content:
<?php
// =============================================================================
// HEADER.PHP
// -----------------------------------------------------------------------------
// The site header.
// =============================================================================
x_get_view( 'header', 'base' );
But honestly, for some reasons it doesn´t help. Can someone show me which is the right way to do it?
Many thanks
Yeah, that was my thought. The script is in effect already there, but the theme says anyway, that the code is missing.
I'm working on a Wordpress theme locally. At some point all of the sudden changes to my header.php template stopped showing up on the site. A change in any other file is visible. I believe this started happening after I played around with Appeareance->Menu.
What I've done so far:
Made sure it's the right file, right path - yes
Cleared browser cache
added define( 'WP_CACHE', false ); in wp-config.php
erased all the code in the header.php file - no change, website looks normal so I undo the erase
removed get_header() from page.php - the website got ugly, put it back on - the website looks ok but still no changes visible from header.php (I have a huge <h1>blah blah</h1> in there)
rolled back a few commits back - still nothing
switched to another theme and then back to my theme - still no changes to header.php
performed rm -rf on wp-content/cache/* - still nothing
checked my theme on a different WordPress install - MY CHANGE IS VISIBLE, but I want it where it was so far so that doesn't solve my issue but it does seem to be some cache issue after all if it shows up in another install.
What else can I do? I've been out of ideas for a few days now.
I finally figured it out (actually my programming duck did). It was a plugin (Elementskit Light) causing this strange behaviour.
You might've activated the Header from ElementsKit. (https://i.imgur.com/LC2RRVu.png)
You can simply turn off the Header. (https://i.imgur.com/n8Uzxkn.png)
But if you like to keep it activated and also need some additional custom code. Then ElementsKit also provides some hooks you can use.
These hooks are:
// Before Header
do_action( 'elementskit/template/before_header' );
// After Header
do_action( 'elementskit/template/after_header' );
// Before Footer
do_action( 'elementskit/template/before_footer' );
// After Footer
do_action( 'elementskit/template/after_footer' );
I have this in my index.php file. It adds the home banner image in WordPress. I know that it is mostly generated in WordPress customizer, but I need to add an anchor tag in this section. I can't find it anywhere in the file structure.
<?php do_action('cleanblog_index_top'); ?>
I'm not able to find where cleanblog_index_top leads to. Any help would be great. Thank you!
I stumbled on this old one while looking up the docs for do_action(). The answers are brutal so I decided to provide a better answer in case anyone else stumbles here.
If a WordPress theme has something like do_action( 'example_action_hook_tag' ) somewhere in one of the template files (such as index.php, page.php or whatever) the purpose is to provide theme or plugin authors with a way to write their own custom function that they can then "hook" onto the action with the function add_action().
WordPress would then call this function any time and anywhere do_action( 'example_action_hook_tag' ) is called.
The creators of commercial themes will often litter their template files with hooks declared with do_action() to make it easier for their customers to customize their themes via functions.php or by writing a site-specific plugin.
It looks to me that this is the likely scenario that is impacting the OP. This also explains why the OP was unsuccessful in finding where this "leads to".
It would only "lead somewhere" if the OP wrote a function in the theme/child-theme functions.php or in a plugin and added the line do_action( 'cleanblog_index_top', 'name_of_ops_function' ) to hook their function onto the cleanblog_index_top. WordPress would then call their function when do_action( 'cleanblog_index_top' ) was called in index.php.
From the name of the OP's hook, cleanblog_index_top, it sounds like the theme author intended to provide a way for others to inject output at the top of the index page template.
Suppose the OP wanted <h1>Hello World</h1> to appear there.
In functions.php of a theme/child-theme the OP could add a function that echo's this out:
function op_customization() {
echo '<h1>Hello World</h1>';
}
And hook their function onto cleanblog_index_top:
add_action( 'cleanblog_index_top', 'op_customization' );
Cheers!
You should never edit the index.php file directly, for the same reason you should never edit core Wordpress files directly - the next time WP pushes an update, your changes will be overwritten (and that assumes you don't break anything). Never edit plugin files directly, same reason.
You need to look in your theme, you should only make changes to the functions.php and style.css files in your theme - unless you create a child theme and that is a topic you should Google.
Recently, my Wordpress site went https, but now this is causing Google Fonts to be blocked. After reading around, I gather I need to remove the "http" from the "http://" with the Google font API code. However... I can not find it anywhere. I've looked in function.php, header.php and the CSS stylesheet. Tried using the inspector, but to no avail.
I know next to nothing about this kind of thing, so forgive me for sounding totally clueless. Any help would be wonderful.
The site: https://annasportfolio.com/
your site source has the line
<link rel='stylesheet' id='googleFonts-css' ...>
so take off the "-css" from the id and you'll have the handle for that style: "googleFonts". You can then try to use wp_dequeue_style in your functions.php to get rid of it.
function remove_styles_example() {
wp_dequeue_style( 'googleFonts' );
}
add_action( 'wp_print_scripts', 'remove_styles_example', 100 );
then replace it with your own
wp_enqueue_style( 'myGoogleFonts', '//fonts.googleapis.com/css?family=Montserrat', array(), '4.9.1', 'all' );
refs:
https://codex.wordpress.org/Function_Reference/wp_dequeue_style
https://developer.wordpress.org/reference/functions/wp_enqueue_style/
I'v installed SSL Insecure Content Fixed and had to select HTTP_CF_VISITOR (Cloudflare Flexible SSL); deprecated, since Cloudflare sends HTTP_X_FORWARDED_PROTO now since I'm using Cloudflare.
I am searching for the exact location in which file, where the <title> tag is being filled. Could anyone point me there?
I've searched all the sites I could find but I could not find it :(
well there are many title tags in the wordpress theme but i think what you are looking for is located in : wp-content/themes/theme_name/header.php
<title><?php wp_title( '|', true, 'right' ); ?></title>
The <title> tag can be found in the header.php file of a theme's base directory.
This generally calls the wp_title function, which according to the wordpress documentation, can be found in wp-includes>general-template.php
Wordpress Documentation
Normally the title tag is in the header.php
/wp-content/themes/(your theme name here)/header.php
The answers above are true for WordPress versions earlier than 4.1. There is actually a much easier, much more dynamic way of adding the title tag into WordPress that doesn't require hardcoding <title>.
If you have WordPress version 4.1 or later, you might want to check your functions file for: add_theme_support( 'title-tag' );
If that's in there, the title tag is being generated by WordPress.
https://codex.wordpress.org/Title_Tag