I followed this tutorial here to get a "base" theme set up:
http://themeshaper.com/2009/06/22/wordpress-themes-templates-tutorial/
Everything has been working great, but now on the last part, styling the "news feed" page I want the sidebar to show up. Everything in the theme, for what I can understand is set up correctly. There are two widget areas defined in the functions.php "primary" and "secondary", the unmodified functions.php and sidebar.php can be viewed here:
http://code.google.com/p/your-wordpress-theme/source/browse/trunk/functions.php
and
http://code.google.com/p/your-wordpress-theme/source/browse/trunk/sidebar.php
So this is what happens, I go into the appearance -> widgets manager in the admin. The primary and secondary widget area show up on the right.
I drag the categories and recent posts widgets to the primary (or secondary it doesnt matter). I click save on each widget for good measure and then if I browse away and come back the widgets are gone. Nothing is saved.
I'm not using any plugins, I have no 3rd party or custom widgets. These are just the default vanilla wordpress widgets.
I have debugging enabled in the config file but I get no output of any error when I save the widget config. I've even checked the page source after updating the widget and there is no hidden errors at the bottom as some have suggested.
If someone cannot tell me how to fix this, is there anyone that can at least tell me how to debug this, or get some sort of error message from this thing?
Try this
Go to your wp-admin --> and appearance --> widgets
then on the right top you will see a screen options button (a popdown menu) from there Enable accessibility mode and try your widgets
Some suggestions:
-install debug bar http://wordpress.org/extend/plugins/debug-bar/
enable WP_DEBUG in wp-config
try to clear cache / use different browser or computer
I was having this issue and thought I would add my findings and update this post. I am currently running version 4.9.8. I learned that you can not use Camel case as the id.
This line does not work.
register_nav_menu( 'newThemeArea', __( 'New Widget Area', 'theme' )
This line does work
register_nav_menu( 'newthemearea' , __( 'New Widget Area', 'theme' )
In my case, my widget had input fields with type="number", and the min attributes had fractions of numbers -- once I've rounded them up and showed them as ints, it worked.
Set id of widget like
'id' => 'high-light-header',
instead of
'id' => 'highLightHeader',
Related
I tried googling this, but not having much luck...
I have been able to create a menu using wordpress and entering this code in my header:
<?php wp_nav_menu( array( 'theme_location' => 'header-menu' ) ); ?>
And this in my scripts part:
function register_custom_menu() {
register_nav_menu('header-menu',__( 'Header Menu' ));
}
add_action( 'init', 'register_custom_menu' );
But it seems that when trying to sort it, using the left side bar in the customize theme mode, it will not sort the menu nor will it remove any part of the menu that I add or remove using it.
From what I can tell it's just pulling my pages that I created within wordpress.
Keep in mind, this is a new theme I'm creating - my first theme. I have no PHP experience. Trying to learn as I go.
Picture of issue
I removed some of the names of the links for public view. I need to figure out how to also style this properly, but I've seen some other posts about it, so I'll review those later.
If someone can help me get this side menu to work with my current menu that would be great!
If you try altering your wp_nav_menu call to the following (no parameters):
<?php wp_nav_menu(); ?>
It should fall back on the first non-empty menu. While you may want additional menus later/will likely want to customize your menu(s) more, this should help with troubleshooting as whatever initial menu you have created (is non-empty) is the menu being edited by the customize page.
From what I can tell it's just pulling my pages that I created within
wordpress.
This likely relates to the setting "Automatically add new top-level pages to this menu" in the menu settings tab. This may be found under Appearance >> Menus, or under Customize >> Menus >> Clicking on the arrow to the right of your primary menu >> menu options (at the bottom of the resulting tab on the left).
Have you tried building the menu through Appearance-->Menu?
In the Wordpress backend, go to "Design > Menus", create a new menu there, add all entries you want to have, give it a name and in the "positions" tab on that page, assign it to the defined position in your theme (header-menu in your case). And disable the option to add all new pages/posts automatically.
Recently, when I view a page in Wordpress Preview mode, it always loads the default template (theme page.php file) whereas when I look at the published page, it's the right template. I have around 10 different templates for my pages. Just keep in mind that I'm not talking about the theme itself, but the Wordpress template structure. I included three pictures. The admin panel one, shows different templates for my page.As shown, I chose Fixed-Width Clean Page. The second picture shows the page in Preview mode.As you can see it includes a sidebar which is included in the default template but not the one that I chose. And the last picture is the Live view of the website which is correct. As you can see the sidebar doesn't exist. I searched all over the internet and did some suggestions, but none of them work (like saving the permalinks again, changing the theme and changing it back again, etc). The only change that I recently made was upgrading to Wordpress 4.7.4 and blocking access to admin panel by ip using .htaccess file (I removed the .htaccess file, but still no luck). Any suggestions would be appreciated.
OK, after some time I figured out what the problem was. The "WP Subtitle" plugin version 2.9, breaks the preview functionality if you have multiple templates. I report the issue to them as well, but posted the answer if somebody came across the same problem. In order to fix the issue temporarily, i commented out the below line (line 74) on the plugin's main file (wp-subtitle.php):
//add_filter( 'the_preview', array( 'WPSubtitle', 'the_preview' ), 10, 2 );
I have developed a Premium theme, but as soon as theme is installed wordpress by default throw some of its widgets in Header Area.
The theme looks very ugly at it first appearance when it is virgin w/o all the theme settings.
Although those widgets can be deleted mannualy from the Widget area of Header, but initially the buyer of that theme wouldn't get a Good Notion.
I want to disable wordpress few default widgets in one particular side bar.
I tried various things and researched on various forums.
I got few solutions such as : WordPress widgets can be completely disabled, but that what I do not want.
Has any one faced the same challenge like me. Please advice.
Summary of The Question: I want to disable wordpress default widgets in only one particular sidebar/widget area.
Thanks!
register a custom area for your header
function theme_widgets_init() {
register_sidebar(array(
'name' => __('Header widget', 'theme'),
'id' => 'sidebar-1',
.............
.............
));
add_action('widgets_init', 'theme_widgets_init');
and output it in your header like that:
<?php dynamic_sidebar('sidebar-1'); ?>
WordPress 3.5
I build a dynamic sidebar via WordPress register_sidebar documentation to which looks like:
$sidebar = array(
'name' => 'Main Side Bar',
'id' => 'Aisis_Side_Bar',
'before_widget' => '<li>',
'after_widget' => '</li>',
'before_title' => '<h2>',
'after_title' => '</h2>'
);
register_sidebar($sidebar);
The problem is, when I go into the widgets section of the admin section to drag and drop widgets onto the sidebar, everything works. If I refresh or leave that page and come back the widgets are gone and the sidebar is empty.
They also do not show up on the front end.
Ideas?
Posting here because it is too long for a comment, not really an answer.
And then you have something like <?php dynamic_sidebar('Main Side Bar'); ?> in your template?
There are two times I've seen WordPress widgets disappear, and both are related to the page doing everything via Ajax. The first is when you are only viewing the Appearance >> Widgets and you leave the page open for a long time, WordPress signs you out but the page keeps acting like normal, even though nothing is saving.
The other time is when there are multiple admins. All widgets and their options get saved every time you click save on any widget, it doesn't just save the info for the widget you clicked save on. So if another person is logged in as admin and is viewing Appearance >> Widgets, then you save your widget to "Main Side Bar", it won't show up in their screen unless they refresh Appearance >> Widgets. So now if they click save on any widget, it saves "Main Side Bar" as empty and "erases" your widget.
Also, if you create multiple widget areas, be sure to add them below the other ones in functions.php. WordPress puts widgets in the proper area based on its ID number, not based on its name or the ID you set. So if "ABC" is the first widget area you register, then you drop some widgets in, then you go register a new area "DEF" above the other one in functions.php, ABC will now be empty.
If none of those situations apply to you, you might want to try changing the ID to use hyphens just for the heck of it. Then start looking in your error log, disabling all plugins, making sure mod_security isn't intercepting the post, stuff like that.
Old question, but today after 3 years, im still have trouble with it, my fix:
Change id of sidebar array from cameCase to something like snake_case or spinal-case !
I'm trying to find the proper way to add a custom widget to the sidebar on the post/page editor page, specifically, in the sidebar under the 'Page Attributes' section. I've been searching various keywords and coming up short. The Wordpress codex docs are limited, so I'm having any luck there either.
If there is a hook that can be used, what is it?
Else, the Wordpress functions needed to add the new control.
I'm guessing that the meta boxes are only displayed under the post section, so that wouldn't be the area I'm looking to edit.
Also, would using the Widget class be the wrong thing to do?
I'm developing for version 2.8 or higher.
You should pose that question on https://wordpress.stackexchange.com/
In short: Widgets on the editor pages are not widgets, don't use the frontend widget class for them. They are functions (callbacks) you need to register for the editor pages. You can differ between post and page and in later WP versions between the post type as well.
The function to add the meta box to the editor pages is: add_meta_box