Help me align my php navigation menu

Discussion in 'HTML & Website Design' started by whiteshadow18, Aug 19, 2010.

  1. #1
    I want to put in the middle my navigation bar, and i don't know how. I have tried with <div align="center"> but it doesn't work. My blog is http://blogspotmedia.net, and my php code for the header is
    <?php /* Mystique/digitalnature */ ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" <?php //language_attributes('xhtml'); ?>>
    
    <head profile="http://gmpg.org/xfn/11">
    <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
    
    <title><?php mystique_title(); ?></title>
    
    <?php mystique_meta_description(); ?>
    <meta name="designer" content="digitalnature.ro" />
    
    <?php if(WP_VERSION < 3.0): ?>
    <link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
    <link rel="alternate" type="application/atom+xml" title="<?php bloginfo('name'); ?> Atom Feed" href="<?php bloginfo('atom_url'); ?>" />
    <?php endif; ?>
    
    <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
    <link rel="shortcut icon" href="http://imediazone.net/favicon.gif" type="image/x-icon"/>
    
    <?php wp_head(); ?>
    </head>
    <body class="<?php mystique_body_class() ?>">
     <div id="page">
    
        <div id="header" class="bubbleTrigger">
        
     <?php do_action('mystique_header_start'); ?>
    
    
    <div id="banner">       
    <div align="center"><img src="http://blogspotmedia.net/banner.jpg" alt="Best Business Blog"></div>
    </div>
    <?php do_action('mystique_header'); ?>
    
    
    <?php mystique_navigation(); ?>
          
    
          <?php do_action('mystique_header_end'); ?>           
    
        </div>
    
    
    
      <!-- left+right bottom shadow -->
      <div class="shadow-left page-content main-wrapper">
       <div class="shadow-right">
    
         <?php do_action('mystique_before_main'); ?>
    Code (markup):

     
    whiteshadow18, Aug 19, 2010 IP
  2. CSM

    CSM Active Member

    Messages:
    1,047
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    55
    #2
    In your style.css is this:

    
    ul.navigation {
    background:url("images/nav.png") repeat-x scroll left top #EEEEEE;
    list-style-type:none;
    margin:0;
    padding:0;
    position:relative;
    width:100%;
    z-index:15;
    }
    
    Code (markup):
    Around line 122 I think.

    Replace width:100%; with width:826px; and margin:0; with margin:0 auto;

    Should work.
     
    CSM, Aug 19, 2010 IP
  3. whiteshadow18

    whiteshadow18 Peon

    Messages:
    378
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    It worked, but not as i expected, the navigation background disappeared, check it out.
     
    whiteshadow18, Aug 19, 2010 IP
  4. CSM

    CSM Active Member

    Messages:
    1,047
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    55
    #4
    Put that ul.navigation div in another div with the navigation background, done.
     
    CSM, Aug 19, 2010 IP
  5. whiteshadow18

    whiteshadow18 Peon

    Messages:
    378
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Can you give me an example, because i am a kind of newbie.
     
    whiteshadow18, Aug 19, 2010 IP
  6. CSM

    CSM Active Member

    Messages:
    1,047
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    55
    #6
    To do that I need to hack the php code from that template. Today I do not have time to do that.
     
    CSM, Aug 19, 2010 IP
  7. whiteshadow18

    whiteshadow18 Peon

    Messages:
    378
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Here is the main index template:
    <?php
     /* Mystique/digitalnature */
     get_header();
    ?>
    
      <!-- main content: primary + sidebar(s) -->
      <div id="main">
       <div id="main-inside" class="clear-block">
    
        <!-- primary content -->
        <div id="primary-content">
         <div class="blocks">
          <?php do_action('mystique_before_primary'); ?>
          <?php
           if (have_posts()):
            while (have_posts()):
             the_post();
             mystique_post();
            endwhile;
    
            mystique_pagenavi();
           else: ?>
           <h1 class="title error"><?php _e("No posts found","mystique"); ?></h1>
           <p><?php _e("Sorry, but you are looking for something that isn't here.","mystique"); ?></p>
    
          <?php endif; ?>
          <?php do_action('mystique_after_primary'); ?>
         </div>
        </div>
        <!-- /primary content -->
    
        <?php get_sidebar(); ?>
    
       </div>
      </div>
      <!-- /main content -->
    
    <?php get_footer(); ?>
    
    
    Code (markup):
    AND the page template

    
    <?php
     /* Mystique/digitalnature */
     get_header();
    ?>
    
      <!-- main content: primary + sidebar(s) -->
      <div id="main">
       <div id="main-inside" class="clear-block">
        <!-- primary content -->
        <div id="primary-content">
         <div class="blocks">
           <?php do_action('mystique_before_primary'); ?>
           <?php
    
            if (have_posts()):
             while (have_posts()):
              the_post();
              mystique_page();
             endwhile;
            endif;
    
            comments_template();
           ?>
           <?php do_action('mystique_after_primary'); ?>
         </div>
        </div>
        <!-- /primary content -->
    
        <?php get_sidebar(); ?>
    
       </div>
      </div>
      <!-- /main content -->
    
    <?php get_footer(); ?>
    
    
    Code (markup):
     
    whiteshadow18, Aug 19, 2010 IP
  8. kiramanic

    kiramanic Peon

    Messages:
    205
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #8
    The HTML for the menu is being generated by the mystique_navigation() function. All you need to do is find that function and add your containing div around the menu.

    Try functions.php first, if it's not in there you might have an includes folder or something depending on the theme.
     
    kiramanic, Aug 19, 2010 IP
  9. whiteshadow18

    whiteshadow18 Peon

    Messages:
    378
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #9
    The functions.php looks like this:
    <?php /* Mystique/digitalnature */
    
    //error_reporting(E_ALL & ~E_NOTICE);
    
    define('WP_VERSION', $wp_version);
    if (WP_VERSION < 2.9): // disable theme front end if wp < 2.9
    
      function mystique_unsupported_wp_version(){ ?>
      <div class='error fade'>
       <p>
       <?php
        printf(__('Your site is running on %1$s. Mystique requires at least %2$s.','mystique'), 'Wordpress '.WP_VERSION, '<a href="http://codex.wordpress.org/Upgrading_WordPress">Wordpress 2.9</a>');           if (current_user_can('switch_themes') && !is_admin()) echo '<br /><a href="'.get_bloginfo('wpurl').'/wp-admin/">'.__("(Dashboard)","mystique").'</a>';
       ?>
       </p>
      </div>
      <?php if(!is_admin()) die();
      }
    
      add_action('admin_notices', 'mystique_unsupported_wp_version');
      add_action('wp', 'mystique_unsupported_wp_version');
    
    else:
    
      $mystique_theme_data = get_theme_data(TEMPLATEPATH.'/style.css');
      define('THEME_NAME', $mystique_theme_data['Name']);
      define('THEME_AUTHOR', $mystique_theme_data['Author']);
      define('THEME_URI', $mystique_theme_data['URI']);
      define('THEME_VERSION', trim($mystique_theme_data['Version']));
      define('THEME_URL', get_bloginfo('template_url'));
    
      // end of line character
      if(!defined("PHP_EOL")) define("PHP_EOL", strtoupper(substr(PHP_OS,0,3) == "WIN") ? "\r\n" : "\n");
    
      if (class_exists('xili_language')):
       define('THEME_TEXTDOMAIN','mystique');
       define('THEME_LANGS_FOLDER','/lang');
      else:
       load_theme_textdomain('mystique', get_template_directory().'/lang');
      endif;
    
      // core files, required
      require_once(TEMPLATEPATH.'/lib/core.php');
      require_once(TEMPLATEPATH.'/lib/settings.php');
    
      // optional, shortcodes
      require_once(TEMPLATEPATH.'/lib/shortcodes.php');
    
      // optional, extensions
      require_once(TEMPLATEPATH.'/extensions/ip2country/ip2country.php');
      require_once(TEMPLATEPATH.'/extensions/code-editing/code-editing.php');
      require_once(TEMPLATEPATH.'/extensions/featured-posts/featured-posts.php');
      require_once(TEMPLATEPATH.'/extensions/xtra-nav/xtra-nav.php');
    
      require_once(TEMPLATEPATH.'/lib/widgets.php');
      if(is_admin()) require_once(TEMPLATEPATH.'/admin/theme-settings.php');
    
      if(current_user_can('edit_posts')):
        require_once(TEMPLATEPATH.'/lib/editor.php');
        add_filter('mce_css', 'mystique_editor_styles');
        add_filter('mce_buttons_2', 'mystique_mcekit_editor_buttons');
        add_filter('tiny_mce_before_init', 'mystique_mcekit_editor_settings');
      endif;
    
      // search adjustments
      add_filter('pre_get_posts','mystique_exclude_pages_from_search');
    //  add_filter('posts_where', 'mystique_search_where');
    //  add_filter('posts_join', 'mystique_search_join');
    //  add_filter('posts_groupby', 'mystique_search_groupby');
      add_action('mystique_jquery_init', 'mystique_highlight_search_query');
    
      add_action('init', 'mystique_verify_options');
      add_action('init', 'mystique_user_functions');
      add_action('wp_head', 'mystique_load_stylesheets', 1);
      add_action('wp_head', 'mystique_load_scripts', 1);
      add_action('template_redirect', 'mystique_meta_redirect');
      //add_action('get_header', 'mystique_compress_html');
    
      add_filter('query_vars', 'mystique_query_vars');
      add_action('template_redirect', 'mystique_dynamic_css_and_js');
    
      add_filter('excerpt_more', 'mystique_excerpt_more');
    
      // set up widget areas
      if (function_exists('register_sidebar')):
          register_sidebar(array(
            'name' => __('Default sidebar','mystique'),
            'id' => 'sidebar-1',
            'description' => __("This is the default sidebar, visible on 2 or 3 column layouts. If no widgets are active, the default theme widgets will be displayed instead.","mystique"),
            'before_widget' => '<li class="block"><div class="block-%2$s clear-block" id="instance-%1$s">',
      		'after_widget' => '</div></li>',
      		'before_title' => '<h3 class="title"><span>',
      		'after_title' => '</span></h3><div class="block-div"></div><div class="block-div-arrow"></div>'
          ));
    
          register_sidebar(array(
            'name' => __('Secondary sidebar','mystique'),
            'id' => 'sidebar-2',
            'description' => __("This sidebar is active only on a 3 column setup. ","mystique"),
      	    'before_widget' => '<li class="block"><div class="block-%2$s clear-block" id="instance-%1$s">',
      		'after_widget' => '</div></li>',
      		'before_title' => '<h3 class="title"><span>',
      		'after_title' => '</span></h3><div class="block-div"></div><div class="block-div-arrow"></div>'
          ));
    
          register_sidebar(array(
            'name' => __('Footer','mystique'),
            'id' => 'footer-1',
            'description' => __("You can add between 1 and 6 widgets here (3 or 4 are optimal). They will adjust their size based on the widget count. ","mystique"),
      		'before_widget' => '<li class="block block-%2$s" id="instance-%1$s"><div class="block-content clear-block">',
      		'after_widget' => '</div></li>',
      		'before_title' => '<h4 class="title">',
      		'after_title' => '</h4>'
          ));
    
          register_sidebar(array(
            'name' => __('Footer (slide 2)','mystique'),
            'id' => 'footer-2',
            'description' => __("Only visible if jQuery is enabled. ","mystique"),
      		'before_widget' => '<li class="block block-%2$s" id="instance-%1$s"><div class="block-content clear-block">',
      		'after_widget' => '</div></li>',
      		'before_title' => '<h4 class="title">',
      		'after_title' => '</h4>'
          ));
    
          register_sidebar(array(
            'name' => __('Footer (slide 3)','mystique'),
            'id' => 'footer-3',
            'description' => __("Only visible if jQuery is enabled. ","mystique"),
      		'before_widget' => '<li class="block block-%2$s" id="instance-%1$s"><div class="block-content clear-block">',
      		'after_widget' => '</div></li>',
      		'before_title' => '<h4 class="title">',
      		'after_title' => '</h4>'
          ));
    
          register_sidebar(array(
            'name' => __('Footer (slide 4)','mystique'),
            'id' => 'footer-4',
            'description' => __("Only visible if jQuery is enabled. ","mystique"),
      		'before_widget' => '<li class="block block-%2$s" id="instance-%1$s"><div class="block-content clear-block">',
      		'after_widget' => '</div></li>',
      		'before_title' => '<h4 class="title">',
      		'after_title' => '</h4>'
          ));
      endif;
    
      // set up post thumnails
      add_theme_support('post-thumbnails');
      $size = explode('x',get_mystique_option('post_thumb'));
      set_post_thumbnail_size($size[0],$size[1], true);
      add_image_size('featured-thumbnail', 150, 150);
    
      // nav menus
      if(function_exists('register_nav_menus')) register_nav_menus(array('primary' => __('Primary Navigation', 'mystique')));
      
      add_theme_support('automatic-feed-links');
    endif;
    ?>
    Code (markup):
    and i don't know where to search for the includes. You can download my theme from: http://blogspotmedia.net/download/mystique.rar
     
    whiteshadow18, Aug 20, 2010 IP
  10. CSM

    CSM Active Member

    Messages:
    1,047
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    55
    #10
    It's the core.php in lib folder, not functions.php
     
    CSM, Aug 20, 2010 IP
  11. whiteshadow18

    whiteshadow18 Peon

    Messages:
    378
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #11
    So how do i add the containing div around the menu, can you give me exactly the code, i am very sorry for being a pain in the neck but i don't understand, so if you can please give me exactly the code.
     
    whiteshadow18, Aug 20, 2010 IP
  12. whiteshadow18

    whiteshadow18 Peon

    Messages:
    378
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Can anyone please help me
     
    whiteshadow18, Aug 21, 2010 IP
  13. CSM

    CSM Active Member

    Messages:
    1,047
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    55
    #13
    You could ask the developer of the wordpress template. Perhaps they have a forum.
     
    CSM, Aug 21, 2010 IP
  14. whiteshadow18

    whiteshadow18 Peon

    Messages:
    378
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #14
    Problem fixed
     
    Last edited by a moderator: Aug 21, 2010
    whiteshadow18, Aug 21, 2010 IP