I'm new to Drupal so bear with me. I'm using the Omega theme (http://drupal.org/project/omega) and created a custom menu to use as the main menu. In the template I'm using this to get and display the menu:
<?php print theme('links', array('links' => menu_navigation_links('menu-omega-main-menu'), 'attributes' => array('id' => 'main-menu', 'class' => array('links', 'inline', 'clearfix', 'main-menu'))));?>
When I go to view the site, the menu shows, however the children menu links do not get rendered. I also attempted this:
<?php print theme('links', array('links' => menu_navigation_links('menu-omega-main-menu',1), 'attributes' => array('id' => 'main-menu', 'class' => array('links', 'inline', 'clearfix', 'main-menu'))));?>
to try to set the level depth the menus are rendered but then doesn't show at all.
To the first question that most people will try to ask, yes I have 'Show as expanded' checked.
Related
I have created a textarea in WordPress Customizer in the following way.
$wp_customize->add_setting( "stylesheet_setting", array(
'default' => '',
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'transport' => 'postMessage',
'sanitize_callback' => 'sanitize_textarea_field',
) );
$wp_customize->add_control( "stylesheet_setting", array(
'section' => "stylesheet_section",
'type' => 'textarea',
) );
Problem
The Problem I am having is that, when I write CSS code in this textarea, it does not update the preview pane in realtime, instead, if I use the refresh method for transfer, it updates after refreshing.
I want to update in real-time just like I enter CSS in WordPress Custom CSS Textbox.
Im trying to create a sub section within the customiser options in WordPress, so i have a new section called Typography and i want to make sub sections inside that which will be Heading 1, Heading 2 etc... those should open out into their own set of controls. However i have been looking through the codex and cant seem to find a way to link those menus up, any ideas?
Below is the normal code for adding a section but adding a new one doesnt seem to have a option for attaching it to the parent? Ive tried a few variations of the code below without any luck, all i get is 2 typography menus on the main menu.
EDIT: Still having no luck, i read in the codex about a option for panels but cant seem to implement it.
i am using the code below, its just a simplified version of the code to make sure i have it right. I assume a section goes into the panel and the settings and control go into the section. Using this codex
// ADD PANEL
$wp_customize->add_panel( 'typography_panel', array(
'priority' => 10,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => 'Typography',
'description' => 'contains options for all font settings on the website.',
) );
// ADD SECTION TO GO INTO PANEL
$wp_customize->add_section( 'heading_1', array(
'priority' => 20,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => 'H1 Options',
'description' => 'all options for heading 1 font.',
'panel' => 'typography_panel',
) );
// ADD SETTINGS
// Selector Background - Highlighting
$wp_customize->add_setting(
'typography_highlight_background_h1',
array(
'default' => '#333948',
'sanitize_callback' => '',
) );
// ADD CONTROLS
// Highlight Background for Browser
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize, 'typography_highlight_background_h1',
array(
'label' => __( 'Highlight Background', 'typography_highlight_background_h1' ),
'section' => 'heading_1',
'settings' => 'typography_highlight_background_h1',
) ) );
You're looking for add_setting and add_control. Sub-sections can be added by passing the name of the section as an argument to add_control.
I'm using a theme and added the polylang plugin to make the site multilingual. And it's quite confusing to make the menu multilingual.
wp_nav_menu( array(
//'theme_location' => 'header-menu',
'theme_location' => '',
'menu' => 'id',
'orderby' => 'menu_order'
));
In my header I have this wp_nav_menu() function. When using this option 'theme_location' => '' the order of the menu is correct but is not switching when clicking on the second language flag. Using this option: 'theme_location' => 'header-menu' changes menu when clicking on the flags but the menu items aren't in the correct order. In the wp dashboard under appearence menus there are two menus and the polylang settings for these seems to be correct. Anyone knows what's causing the problem and how to fix it?
Problem solved. I was using a theme which had this line of code in it's functions.php:
register_nav_menus( array(
'primary' => __( 'Primary Navigation', '<theme_name>' ),
) );
So I had to use:
'theme_location' => 'primary'
in the wp_nav_menu function.
I have a problem, I need to change the default options for a “List-item” option in Option tree . Right now the default are “Title/Image/Link/Descriptions” .. I want to remove them and add my own. I have written this code:
array(
'id' => 'academic_success_content',
'label' => 'Academic Success Content',
'desc' => 'Enter the academic success content. It will appear in the home page in list items format',
'std' => '',
'type' => 'list-item',
'section' => 'academic_perfomance',
'settings' => array(
array(
'id' => 'academic_success',
'label' => 'Academic Success',
'type' => 'textarea-simple',
)
)
),
But when I preview the themes options , the default list item "title" is still there and I only want to see the Academic Success textarea. What should I do?
I also suffered from the same situation.
And after that, I use the older version of "list-item" and "gallery".
This has worked well. Ex: v2.4.6
Is the theme options page being included?
You'll need to reference it in your functions.php, something to the effect of:
require_once locate_template('/path-to-your/theme-options.php' );
I'm trying to add a couple of sections onto the user profile in Drupal 7 under:
<div class="profile" typeof="sioc:UserAccount" about="/drupal/user/1">
I'm adding three new sections, but the problem is that, although I am using the same way to add the three sections, only one of them is rendered as a child of the div above, while the other two are rendered as siblings. What am I doing wrong?
This is how I'm creating the content:
function plan_user_user_view($account) {
//Create the markup for the events region
$account->content['events'] = array(
'#type' => 'user_profile_item',
'#theme' => 'events',
'#events' => $events);
//Create the region for the venues
$account->content['venues'] = array(
'#type' => 'user_profile_item',
'#theme' =>'venues',
'#userid' => $user->uid,
'#venues' => $venues);
//Create the region for creating an event
$account->content['creator'] = array(
'#prefix' => '<div class="user-event-item" id="quick-event-creator">',
'#suffix' => '</div>',
'#type' => 'user_profile_item',
'#title' => t('QUICK EVENT CREATOR'),
'#markup' => drupal_render(drupal_get_form('event_creation')));
}
Also, is there a better way to create that last piece of content there? The other two seem fine in a template file but the last one since it's a form I was wondering if there are better ways of doing that.
Thanks,
Maybe you should have a look on this project profil2 which is the successor of content_profil for Drupal 6. With it you will be able to add informations onto users profils and if you want to code your custom fields by yourself it should be a good starting point to read.
Best.
How about this:
// Create the category.
$account->content['mymodule'] = array(
'#type' => 'user_profile_category',
'#title' => t('My module content'),
);
// Create first item (child).
$account->content['mymodule']['events'] = array(
'#type' => 'user_profile_item',
'#title' => t('Events'),
'#markup' => t('Whatever'),
);
// Create second item (child).
$account->content['mymodule']['venues'] = array(
'#type' => 'user_profile_item',
'#title' => t('Venues'),
'#markup' => t('Whatever'),
);
and so on. The bottom line is that user_profile_item items should be children of a user_profile_category item.