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'); ?>
Related
I would like to create a second navigation menu that goes below the main one (The one that contains the "About" and "Contact" etc. categories). This one would have images that have links and also which show text under them when hovered on. I have already created the necessary HTML and CSS for it, I just don't know how I would implement that into my site. The images and links are in a table, but the Wordpress navigation menu is a list, so I'm kind of stuck on what to do.
Are you using a default/premium/free theme, or did you create one by yourself?
I assume the first, so here are a few things you need to know.
Wordpress uses hooks, so you can "link" your code at a certain point of their code, when a website is called. In its codex, you can learn more about how navigation menus are registered and called later on.
A theme is something like a base, when you create your own website. You can create child themes and implement every further functionality and design changes
right there.
In short: implement your menu, put it in your child theme and use the hooks to get it where you need.
Standard way of adding a secondary menu to a theme is as follows.
register_nav_menus( array(
'primary' => __( 'Primary Menu', 'yourtheme'),
'secondary' => __( 'Secondary Menu', 'yourtheme' ),
) );
Nevermind, the question I was trying to ask is where do I put my HTML code of the table so that it shows up on the header, but I found the solution through sheer luck. I put the HTML into the header.php of my child theme and linked the CSS classes to those that I pasted into the style.css . Still, thanks to those who tried to answer!
I am working on one Wordpress website. We use twentyeleven theme. Site is available in 3 languages, Czech, English and Russian. For translations we use qTranslate plugin for Wordpress qTranslate plugin .
In the beginning we didn't have any problems with translations. But after some time qTranslate stopped translate navigation menu items. We have 3 menus and each of them has specific items. If I don't select main navigation menu in theme properties then translation works, but all menu items from 3 menus are shown in one big menu, which is not good. If I choose one of these 3 menus as main, then translation stop working. The weird thing is that only menu items don't translate, other parts of website (articles, headers, links) are translated properly.
Have you ever had this kind of problem with this plugin ?
My approach to multilanguage menus in wordpress was:
In the header.php theme file:
<?php wp_nav_menu( array(
'theme_location' => 'top_menu',
'menu' => 'Menu ' . substr(get_bloginfo ( 'language' ), 0, 2) ,
'menu_id' => 'mainnav',
'sort_column' => 'menu_order',
)); ?>
Then I've created different menus for each language:
The function I've used get_bloginfo returns the locale in the qTranslate section:
It worked for me. Add suggestions or other plugins to turn this into an easy task.
I had the same problem.
In WordPress Dashboard check in Appearance -> Menu under Menu Structure.
Click the arrow on the right of the item to reveal additional configuration options and check if Navigation Label names are different when you change languages with q-translate if not add your own translations.
Hope that helps.
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 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',
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