javascript is breaking admin portion of wordpress
-
Hello,
In an attempt to vertically center the thumbnail images in my galleries I loaded some javascript (I’m very new to javascript) into the “js” folder of the graphene theme and then added the following code to the “functions.php”
“
<?php
function load_scripts() {
// wp_enqueue_script(‘jquery’);
// wp_enqueue_script(‘boccia’, ‘/wp-content/themes/graphene/js/boccia.js’, array(‘jquery’));
wp_enqueue_script(‘boccia’, ‘/wp-content/themes/graphene/js/boccia.js’);
}
add_action(‘init’, ‘load_scripts’);
?>
“
Now when I try to login to my site I get the following errors:
“
Warning: Cannot modify header information – headers already sent by (output started at /nfs/c03/h01/mnt/50986/domains/tkogfx.com/html/boccia_dev/wp-content/themes/graphene/functions.php:2675) in /nfs/c03/h01/mnt/50986/domains/tkogfx.com/html/boccia_dev/wp-login.php on line 353
Warning: Cannot modify header information – headers already sent by (output started at /nfs/c03/h01/mnt/50986/domains/tkogfx.com/html/boccia_dev/wp-content/themes/graphene/functions.php:2675) in /nfs/c03/h01/mnt/50986/domains/tkogfx.com/html/boccia_dev/wp-login.php on line 365
Warning: Cannot modify header information – headers already sent by (output started at /nfs/c03/h01/mnt/50986/domains/tkogfx.com/html/boccia_dev/wp-content/themes/graphene/functions.php:2675) in /nfs/c03/h01/mnt/50986/domains/tkogfx.com/html/boccia_dev/wp-includes/pluggable.php on line 737
Warning: Cannot modify header information – headers already sent by (output started at /nfs/c03/h01/mnt/50986/domains/tkogfx.com/html/boccia_dev/wp-content/themes/graphene/functions.php:2675) in /nfs/c03/h01/mnt/50986/domains/tkogfx.com/html/boccia_dev/wp-includes/pluggable.php on line 738
Warning: Cannot modify header information – headers already sent by (output started at /nfs/c03/h01/mnt/50986/domains/tkogfx.com/html/boccia_dev/wp-content/themes/graphene/functions.php:2675) in /nfs/c03/h01/mnt/50986/domains/tkogfx.com/html/boccia_dev/wp-includes/pluggable.php on line 739
Warning: Cannot modify header information – headers already sent by (output started at /nfs/c03/h01/mnt/50986/domains/tkogfx.com/html/boccia_dev/wp-content/themes/graphene/functions.php:2675) in /nfs/c03/h01/mnt/50986/domains/tkogfx.com/html/boccia_dev/wp-includes/pluggable.php on line 934″
and I can not access the admin portion of the site.
Does anyone know what I’m doing wrong or how to correctly add my script to get these images to center? Your help is greatly appreciated.
Thanks!!!
url:
First, you should NEVER edit your core wordpress or graphene files… especially the functions.php file.
What you need to do is use FTP or cPanel to your server, and download those two files you changed, and undo any changes. Then, upload them back to the server, over-writing the ones that are bad.
Once you do this and get your admin back, then we can help you with the centering.
Hi Josh,
I have gotten things working again by replacing those files. I am able to get the thumbs centered right to left using css, but I have been stumped on getting them to align vertically within that gray border box.
Thanks again!
Mod
Add this to custom CSS:
img {border:none;}I added that, but it doesn’t seem to have changed the vertical align issue. I’m trying to center each thumbnail (vertically and horizontally), inside the gray box that contains it.
Mod
Vertical alignment within a
<div>is not easy.You can try this option: http://www.jakpsatweb.cz/css/css-vertical-center-solution.html
or maybe this one: http://blog.themeforest.net/tutorials/vertical-centering-with-css/
I’ll try those out. Thanks!
Is there a way to safely add custom js without breaking the theme?
Mod
Yes, use an action hook in your child theme’s functions.php file and hook it to the
wp_head()action hook.
Viewing 8 posts - 1 through 8 (of 8 total)
- You must be logged in to reply to this topic.
