Wordpress bug and errors - wordpress

I have a site that is almost fixed, but I'm having some errors... So I tried to reinstall the theme but Wordpress remembers all the settings from before (header, etc)... The problem that caused this to happen is that the site has a white bar on the side that doesn't need to be there, and it shrinks the site in half... Both on my laptop, desktop and iphone. Also, the slider doesn't display my featured slides. I get this error at the top of the page when trying to add a new slider:
Notice: wp_deregister_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or init hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in /home/setli/public_html/wp-includes/functions.php on line 2944
Here's the site in question.
I'll hire someone to help me get this fixed asap and pay you via Paypal.

There is a large image (1600px wide) in your navigation area at the top of the page. This image is causing the entire site to get pushed outward and offset the containing div.
You need to add this to your CSS to fix:
#logo {
width: 100%;
overflow: hidden;
}
As for the error you put in your question, I do not see that anywhere. I would suggest completely deleting your theme from the server, and then download/install it again. Have you updated the theme recently? When did these issues start occurring?
Also, it looks like two themes are being using. Are you using a framework and a child theme? Try changing/disabling the child theme.

Quote:
Notice: wp_deregister_script was called incorrectly. Scripts and
styles should not be registered or enqueued until the
wp_enqueue_scripts, admin_enqueue_scripts, or init hooks.
Are you calling the function containing wp_deregister_script directly? Those functions should be called by using actions. Instead of calling that function directly, you should use add_action('wp_enqueue_scripts', 'your_function_name'); to run that function.
You use admin_enqueue_scripts instead of wp_enqueue_script if the script is meant for the WordPress dashboard.
Read more:
admin_enqueue_scripts()
wp_enqueue_script()

Related

Dashicons in wordpress (frontend) won't display

I'm creating a website in WordPress. I'm using dashicons for rating (manually) holidays.
It used to work, but after update the dashicons won't be visible for non-logged in users. Only, if you login, you can see the star ratings.
The star rating should be visible on the left top of each holiday deal.
Who knows a solution?
Website url is www.ikwilopvakantie.nl
Dashicons is the official icon font of the WordPress admin as of 3.8..
To load Dashicons for non logged in users:
Open directory {your-website-folder/wp-content/themes/}
Go into the folder of your active child theme ( if you don't have active child theme, open the folder of your active parent theme )
Find there functions.php file and add the provided code at the end of it (
make sure, there isn't ?> php closing tag at the end of file. if so, just remove it ):
function ww_load_dashicons(){
wp_enqueue_style('dashicons');
}
add_action('wp_enqueue_scripts', 'ww_load_dashicons');
Save changes. Dashicons will loads on your website for all users.
EDIT: there may be some plugin/code, which removed Dashicons from pages. Try to change your code with this one:
function ww_load_dashicons(){
wp_enqueue_style('dashicons');
}
add_action('wp_enqueue_scripts', 'ww_load_dashicons', 999);
Try this:
<span class="bx-next dashicons dashicons-arrow-right-alt2"></span>
'dashicons-arrow-right-alt2' is the class of the icon.
You can find them here: https://developer.wordpress.org/resource/dashicons/#arrow-up-alt
This has to go to your functions.php file:
function load_dashicons(){
wp_enqueue_style('dashicons');
}
add_action('wp_enqueue_scripts', 'load_dashicons');
For me the problem was simply that my browser blocker addons weren't allowing the source of dashicons.css
If you're using the plug-in "Asset CleanUp", you can navigate to "BULK CHANGES" and easily use "Remove site-wide rule" at the line, where the url for "dashicon" is listed.
Many of the icons on the official list were appearing blank for me when defined as a value of the menu-item property in the register_post_type function.
If you open wp-includes/css/dashicons.css you will see a complete list of icons available, many of which have different names, for example dashicons-quote is actually dashicons-editor-quote.
Using these values solved the problem for me. I also found this cheat sheet to be helpful if you don't want to go digging through your source files.
Solved for me— For some reason, dashicons was only not rendering when I wasn't accessing the https:// version of the site.

Trying to change CSS on New-Post page (WP-admin)

I’m inside the New Post page on WP-Admin, where you can create a new post.
At the right column, there’s the category selector, in which you select the category for that new post.
I have something like 15 categories, and therefore the category box is showing with a scrolling bar. Since I need to automate some post creation, I need all the categories to be visible right away, without having to scroll.
So I found the css file that manages the height of the category box (it’s inside /wp-admin/css/edit.css and //wp-admin/css/edit-rtl.css) and there I changed the CSS files to allow a bigger height by default on that box.
However when I open the new post page, it still shows the small box in categories, and when I see the CSS rule, the change I made is not visible. It’s like the CSS is cached or something. I already made sure that my browser is not caching it.
The problem I think it’s because the CSS rules are not pulled directly from CSS files, but from this file:
http://www.website.com/wp-admin/load-styles.php?c=0&dir=ltr&load%5B%5D=dashicons,admin-bar,buttons,media-views,common,forms,admin-menu,dashboard,list-tables,edit,revisions,media,themes,about,nav-menu&load%5B%5D=s,widgets,site-icon,l10n,wp-auth-check&ver=4.7
That file seems to go and gather the CSS information from some place (which I assumed was the CSS files in the wp-admin/css/ folder, in which I could find the exact same CSS rules that were applied to the category box) but for some reason, it’s not retreiving the updated CSS file. Or something else is happening (Server side caching the PHP response and therefore retreiving all the time the old response?)
I wouldn't recommend tampering with core admin files, as any changes you make could be lost from a WordPress update.
The proper way to do it is through a custom function added to your theme or child-theme functions.php file:
add_action('admin_head', 'custom_admin_css');
function custom_admin_css() {
echo '<style>
/* remove scrollbar from categories panel */
.categorydiv div.tabs-panel { max-height: none !important; }
</style>';
}
Another options that will allow you to have CSS for individual pages is to use this OH header/footer plugin. Once you install the plugin you can then add your CSS in the header textarea of the pages admin. Just make sure you enclose your CSS within a <style></style> tag.

Bug with AddThis Wordpress plugin

I got two pages:
1-http://www.aotopo.com.br/servicos/
2-http://www.aotopo.com.br/blog/
In both pages I inserted The addThis plugin.
Local testing is perfect for both, but online just the first one is working.
In 2nd the addThis plugin is located at post-content (just before the "Leia Mais" buttons).
(function help(){
if(somebodyKnowWhy){
pleaseHelpMe();
console.log("Thank you!");
}
})()
If somebody stumbled up in the same issue, I found the answer by a Wordpress.org member (srijith.v) when I asked the same question:
#Erick: I couldn't find addthis_widget.js being imported to the page. How did you add AddThis? Did you use the plugin available for WordPress?
You will need to include http://s7.addthis.com/js/300/addthis_widget.js to the page to render the buttons.
I just added this js to my footer as a source of a script tag and voila.

admin template selection is missing on page creation in wordpress 3.2.x

I am using WordPress 3.2.1 ,
Page template selection drop down is missing on Pages (Add,Edit)
wp-admin > Pages >Add New > Page Attributes
I Edit the Template Page Default page as below code
/*
Template Name: New Template
*/
But still the template drop down no visible , my older version of WordPress it display by default.
Following is the screen shot for more idea
I solved this problem solved by adding the typical following code:
/*
Template Name: Custom
*/
Don't add any spaces after Name:
It'll work if you use template name: as well.
It might help someone: check if your index.php file is in place.
If it's not there, wordpress treats the template as corrupt and it doesn't display the template selection.
This should be simple to troubleshoot. The requirements for the page template to work are straight forward:
The template needs the page title in the top of the file like you've shown (the title needs to be wrapped in a PHP tag, you probably just didn't add it with your example bu I want to make sure you havne't overlooked it):
<?php
/*
Template Name: Custom
*/
?>
The second requirement is that the file is in the root of the theme folder.
With those two requirements in place, it should work. If it isn't working you nave a few possible issues. I list a few off the top of my head:
You might need to re-install WordPress in-case a file was corrupted
during your last update.
It's possible someone has altered the WP-Admin layout using users
roles.
That's all I can thing of at the moment, let me know how it turns out.
I had the same issue. It actually turned out to be a missing style.css file within the template directory in my case.
This happens because the get_post_templates() in class-wp-theme.php first checks for errors. If it finds any then it returns an empty array (no templates are displayed).
A side effect of this is that saving a page would clear the existing template and use the page.php instead.
So in short if the errors() method of your theme returns any errors then no templates dropdown.
hope that helps someone.
Same issued, I found out that in appearance panel in your WordPress dashboard the stylesheet is missing. You shouldn't rename the style.css in your theme folder.
Not sure if this will help anyone, but we solved the problem by disabling our theme and re-enabling it again. We had some other theme folders in the theme directory that we weren't using so we deleted those out as well. good luck, it's a really random problem to solve!
yeah!template dropdown not showing because you have no template So how to solve this::---
1 create template folder in theme
2 create a template in this folder
like:-
<?php /* Template Name: Home */ echo "template"; ?>
and check-in page dropdown will be there.

Customizable background image on WP theme

I have created a wordpress theme and I made it so the background image can easily be changed. The only problem is that currently I have to make the change manually (ie FTP) and Id like to provide my client with a Template options page with an "Upload new background image" option in it.
Im pretty sure this is possible, I just dont know where to start.
Could someone point me out in the right direction?
This will do it for you. Just add the following to your theme's functions.php file:
add_action( 'after_setup_theme', 'add_custom_background' );
This only works in WordPress 3.0 as of now. Of course, you should be running the latest version anyway. It will add a custom background menu in the admin area (under 'Appearance') and will add the styles to the body tag. Also handles uploading, centering/tiling (x, y, or both) images/background colors. Very simple and great functionality.

Resources