Why am i getting a white screen after I enabled debugging? - wordpress

I am new to wordpress. I have been working on a plugin, and when I refreshed the admin page its white. I have enabled all the debugging options on the wp-config file and its still showing a white screen. I have deleted all the code on the plugin I was working on which I assumed caused the white screen and still nothing happens.
Does anyone know how I else I can debug this issue?
Below is my wp-config file. I don't know if I am missing anything or not.
**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*
* For information on other constants that can be used for debugging,
* visit the Codex.
*
* #link https://codex.wordpress.org/Debugging_in_WordPress
*/
error_reporting(E_ALL); ini_set('display_errors', 1);
define('WP_DEBUG', TRUE);
// Tells WordPress to log everything to the /wp-content/debug.log file
define('WP_DEBUG_LOG', true);
// Doesn't force the PHP 'display_errors' variable to be on
define('WP_DEBUG_DISPLAY', TRUE);
// Hides errors from being displayed on-screen
//#ini_set('display_errors', 0);
/* That's all, stop editing! Happy blogging. */
/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');

I found out the issue...
I didn't wrap ABSPATH using a string..
if(!defined(ABSPATH)){
exit;
}
i changed it to
if(!defined("ABSPATH")){
exit;
}

Related

Loss style the style no longer loads wordpress

I don't understand the style bug that I encounter, here is a picture.
Photo of the bug and the console.
This problem comes on mobile and tracker links on PC with the chrome browser.
I encounter it most often on the safari browser, chrome mobile.
I have a child theme here that called the stylesheet here is the code.
Code: 
/**
* Theme functions and definitions
*
* #package HelloElementorChild
*/
/**
* Load child theme css and optional scripts
*
* #return void
*/
function hello_elementor_child_enqueue_scripts()
{
wp_enqueue_style(
'hello-elementor-child-style',
get_stylesheet_directory_uri() . '/style.css',
[
'hello-elementor-theme-style',
],
'1.0.0'
);
}
add_action('wp_enqueue_scripts', 'hello_elementor_child_enqueue_scripts', 20);
I tested to move the jQuery in the head it did not change anything and I call the jQuery by script in WordPress plugin snippets.
```````
`
I'm stalling, I don't know what to look for with this bug.
Thanks in advance for any ideas on how to get around it.

How to disable comments in WordPress blog for non admin users?

In my WordPress website I'm allowing comment section under all articles. The requirement is to allow only for logged in users. If a user is viewing the article without logging in, Now it asks his name and email along with the comments. And it immediately reflects in the comment section. What I want is any one option from below.
Logged out user can comment. But it will be reflect only if admin accepts.
Logged out user doesn't have comment section.
How to achieve anyone requirement?
What you're trying to implement are defaults, already built-in, Wordpress behaviours.
You can either manually set that under settings > discussion and settings > general or implement the following function in your function.php.
Either use init or after_switch_theme as action hook.
<?php
/**
* Define default theme options.
* #link https://codex.wordpress.org/Option_Reference
*/
add_action( 'init', function() {
/**
* comment_moderation
* Before a comment appears, an administrator must always approve the comment.
* #param Integer
*/
update_option( 'comment_moderation', 1 ); // ... default: 0
/**
* comment_registration
* Users must be registered and logged in to comment
* #param Integer
*/
update_option( 'comment_registration', 1 ); // ... default: 0
} ); ?>

Wordpress 239 charactors of unexpected output error

I am new to wordpress. Here is a task for me.
I need to active a plugin that is created already.
Now, when I try to active it, it gives me following error.
The plugin generated 239 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.
So, first thing I did was google. One of the reasong I found was the white-space left behind code somewhere.
So, I followed it and removed blanks from my code. but did not help me out.
Now, I am putting my code herewith this post. Can anyone please help me out. its going really irritating.
<?php
/*
* Plugin Name: Lucky Draw
* Description: Plugin For Lucky Draw Voucher And Spinning
* Author: Techuz Infoweb Pvt. Ltd
*/
/* Die page if access directly from url */
defined('ABSPATH') or die('No script kiddies please!');
ob_start();
/* Runs when plugin is activated */
register_activation_hook(__FILE__, 'luckydraw_install');
/* = Use Wordpress functions in plugin files
---------------------------------------------------- */
if (file_exists(ABSPATH.'wp-load.php')) {
require_once(ABSPATH.'wp-load.php');
}
/* = Include Wordpress datatable class
---------------------------------------------------- */
if(!class_exists('WP_List_Table')){
require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
}
/* = Setup Tables in database
---------------------------------------------------- */
require_once(plugin_dir_path(__FILE__).'ws_setup.php');
register_activation_hook(__FILE__,'ws_luckydraw_setup_tables');
/* = Include All the plugin pages in ws_register_pages.php file
---------------------------------------------------- */
require_once(plugin_dir_path(__FILE__).'ws_register_pages.php');
/* = Include scripts and styles
---------------------------------------------------- */
add_action('admin_enqueue_scripts','ws_luckydraw_load_scripts');
if(!function_exists('ws_luckydraw_load_scripts')) {
function ws_luckydraw_load_scripts() {
wp_enqueue_script('jquery');
wp_enqueue_media();
wp_enqueue_style('thickbox'); // call to media files in wp
wp_enqueue_script('thickbox');
wp_enqueue_script('media-upload');
wp_enqueue_style('jquery-ui-css', plugins_url('lucky-draw/css/jquery-ui.css'));
wp_enqueue_style('style', plugins_url('lucky-draw/css/ld_style.css'));
wp_enqueue_script('jquery-ui-js', plugins_url('lucky-draw/js/jquery-ui.js'));
wp_enqueue_script('jquery-datetimepicker-script', plugins_url('lucky-draw/js/jquery.datetimepicker.js'));
wp_enqueue_script('jquery-validate-js', plugins_url('lucky-draw/js/jquery.validate.js'));
wp_enqueue_script('common-js', plugins_url('lucky-draw/js/common.js'));
}
}
/* = Luckydraw Deactivation
---------------------------------------------------- */
if(!function_exists('ws_luckydraw_deactivate')):
function ws_luckydraw_deactivate() {
flush_rewrite_rules();
}
endif;
register_deactivation_hook(__FILE__, 'ws_luckydraw_deactivate');
?>
Thanks in advance.....
I dont know why? no ones gonna answer here. however I found one, it was silly mistake.
register_activation_hook(FILE, 'luckydraw_install');
was called twice, and above call was of no use for me. So I have removed above call, and error has gone.

Having issue with WordPress wp_enqueue_style

I am building a full design into WordPress for the first time and I am trying to load in stylesheets and script files but all I seem to be getting is the text output of the location.
What I have is below..
wp_enqueue_style('reset', bloginfo('template_url') . '/reset.css');
wp_enqueue_style('style', bloginfo('stylesheet_url'), array('reset'));
wp_enqueue_style('rhino', bloginfo('template_url') . '/rhinoslider-1.05.css', array('reset','style'));
Do I need to put this inside the link tags or something? I thought it would do it all itself; as what's the point loading it that way if it doesn't do it itself? I know it makes sure the same file isn't included twice or something, but if you have to include the link tags yourself and then WP decides not to include the file then you are left with blank link tags!?
Lastly, should I set these up beforehand so I can just call them via their handles? If so, where? functions.php?
Edit: I also tried putting the below in my themes functions.php file but got the same results.
add_action( 'after_setup_theme', 'mmw_new_theme_setup' );
function mmw_new_theme_setup() {
/* Add theme support for post formats. */
add_theme_support( 'post-formats' );
/* Add theme support for post thumbnails. */
add_theme_support( 'post-thumbnails' );
/* Add theme support for automatic feed links. */
add_theme_support( 'automatic-feed-links' );
/* Add theme support for menus. */
add_theme_support( 'menus' );
/* Load style files on the 'wp_enqueue_scripts' action hook. */
add_action( 'wp_enqueue_scripts', 'mmw_new_load_styles' );
}
function mmw_new_load_styles() {
$foo = bloginfo('template_url') . '/reset.css';
$bar = bloginfo('template_url') . '/rhinoslider-1.05.css';
wp_enqueue_style('reset', $foo);
wp_enqueue_style('style', bloginfo('stylesheet_url'), array('reset'));
wp_enqueue_style('rhino', $bar, array('reset','style'));
}
When storing values in a variable via PHP use:
get_bloginfo()
So your new function would now look like:
function mmw_new_load_styles() {
$foo = get_bloginfo('template_url') . '/reset.css';
$bar = get_bloginfo('template_url') . '/rhinoslider-1.05.css';
wp_enqueue_style('reset', $foo);
wp_enqueue_style('style', bloginfo('stylesheet_url'), array('reset'));
wp_enqueue_style('rhino', $bar, array('reset','style'));
}
And be more semantic! It makes code for beginners easier to look at. ($foo could be $resetCssUrl)
I was having similar issues.
The register / enqueue scripts are so that you can globally assign your functions to load in the correct order. You can call them from the page that your working in but it is considered better practice do it this way.
My template has a functions.php but its nealry empty! It sepreates the scripts into 7 subchapters, theme-options, theme-functions, themes-js, etc. Here is my themes.js.php file but this could quite easily placed in your file inside your wp-content/themes/functions.php My themes-js.php file

Fatal error: Call to undefined function load_theme_textdomain()

I do not know if I can ask word press templated questions here. I was trying to add a line to functions.php in order to display images in RSS feeds. However, I missed to add a "/ "at the end of my comment line and my website crashed.
I am getting this error:
Fatal error: Call to undefined function load_theme_textdomain() in /home/content/31/6570531/html/wp-includes/functions.php on line 33
the 33 line of functions.php has this line of code:
load_theme_textdomain( 'btp_theme', get_template_directory().'/languages' );
is there anyone who knows what should I do? I reupload template files but still getting the same error.
this is the part of error I think
/* Initialize translation mechanism */
load_theme_textdomain( 'btp_theme', get_template_directory().'/languages' );
$locale = get_locale();
$locale_file = TEMPLATEPATH . "/languages/$locale.php";
if ( is_readable($locale_file) )
require_once($locale_file);
/* EnableWP Auto Feed Links */
add_theme_support('automatic-feed-links');
/* Enable post thumbnails support */
add_theme_support( 'post-thumbnails' );
/* Enable custom backgrounds support */
add_custom_background();
if ( ! isset( $content_width ) ) $content_width = 593;
I solved my problem and want to share it with you.
You should download a fresh copy of WordPress. Than delete
wp-config.php
and
wp-content directory
from your wordpress copy on your harddrive. These are vital steps in order you to not loose your settings and content.
Than upload the Wordpress files via FTP to your server.

Resources