WordPress.org

Ready to get started?Download WordPress

Forums

How to modify page's links in navbar in Mystique theme (10 posts)

  1. elsatrento
    Member
    Posted 4 years ago #

    I use wordpress blog as part of a site, and I want to use the mystique navbar to link the blog with the rest of the site. Now, I put pages on the navbar to have the proper title, but I don't know how to redirect the navbar's buttons to the rest of the site. So the question is: how can I change the link of the navbar buttons (using the pages)?

  2. darttiglao
    Member
    Posted 4 years ago #

    My guess is the theme (as it is common) uses "wp_list_pages" for the nav bar. So you can just add normal links after that or even make the whole nav with html links

    Ex:

    <ul id="nabar">
      <?php wp_list_pages('child_of=20&exclude=13,151,148,501&sort_column=menu_order&title_li='); ?> <a href="http://yoururladdress">your link</a> </ul>
  3. elsatrento
    Member
    Posted 4 years ago #

    I 'm sorry, I can't find the wp_list_pages, where should it be?

  4. darttiglao
    Member
    Posted 4 years ago #

    Check the header.php. The mystique theme has a very long code for its navigation buttons.

    The navigation code starts starts at <ul id="navigation"> and ends at </ul>.

    Before the </ul> and right after the "endif" php code, you can insert something like this code

    <li><a href="http://yoururladdress">your static link</a> </li>

    Below is the entire navigation block inside the header.php, notice the last few codes:

    <ul id="navigation">
    
             <?php
              $navtype = get_mystique_option('navigation');
              if((get_option('show_on_front')<>'page') && get_mystique_option('exclude_home')<>'1'):
               if(is_home() && !is_paged()): ?>
                <li class="current_page_item" id="nav-home"><a class="home fadeThis" href="<?php echo get_settings('home'); ?>" title="<?php _e('You are Home','mystique'); ?>"><span class="title"><?php _e('Home','mystique'); ?></span><span class="pointer"></span></a></li>
               <?php else: ?>
                <li id="nav-home"><a class="home fadeThis" href="<?php echo get_option('home'); ?>" title="<?php _e('Click for Home','mystique'); ?>"><span class="title"><?php _e('Home','mystique'); ?></span><span class="pointer"></span></a></li>
              <?php
               endif;
              endif; ?>
             <?php
               if($navtype=='categories'):
                echo preg_replace('@\<li([^>]*)>\<a([^>]*)>(.*?)\<\/a>@i', '<li$1><a class="fadeThis"$2><span class="title">$3</span><span class="pointer"></span></a>', wp_list_categories('show_count=0&echo=0&title_li=&exclude='.get_mystique_option('exclude_categories')));
               elseif($navtype=='links'):
    
                $links = get_bookmarks(array(
                'orderby'        => 'name',
                'order'          => 'ASC',
                'limit'          => -1,
                'category'       => null,
                'category_name'  => get_mystique_option('navigation_links'),
                'hide_invisible' => true,
                'show_updated'   => 0,
                'include'        => null,
                'search'         => '.'));
    
                foreach ($links as $link)
                 echo '<li><a class="fadeThis" href="'.$link->link_url.'" target="_blank"><span class="title">'.$link->link_name.'</span></a><li>';
    
               else:
                 echo preg_replace('@\<li([^>]*)>\<a([^>]*)>(.*?)\<\/a>@i', '<li$1><a class="fadeThis"$2><span class="title">$3</span><span class="pointer"></span></a>', wp_list_pages('echo=0&orderby=name&title_li=&exclude='.get_mystique_option('exclude_pages')));
               endif;
              ?>
    <li><a href="http://yoururladdress">your static link</a> </li>
          </ul>
  5. elsatrento
    Member
    Posted 4 years ago #

    Ok, I found the place you're talking about, but I don't know how to procede. You gave me the "youraddress" example, but how can I "tell" the theme that once I insert in the navbar a button as a link for one of the PAGES's blog I want instead to redirect it to one of the page's site? (I hope it's clear, it get confusioned between the "PAGES" in wordpress and the "pages" of the rest of my site)

    Thanks or your help

  6. darttiglao
    Member
    Posted 4 years ago #

    From the example I gave, you can replace the "yoururladdress" in

    <a href="http://yoururladdress">your static link</a>

    with any of your page url address outside WordPress.

    So we are not redirecting (I don't think you need to) but creating or adding static links that are external to your blog.

  7. ClaytonJames
    Member
    Posted 4 years ago #

    Now, I put pages on the navbar to have the proper title, but I don't know how to redirect the navbar's buttons to the rest of the site. So the question is: how can I change the link of the navbar buttons (using the pages)?

    This makes it simple. I'm using it right now on the Mystique theme to redirect page titles in the navbar to off-site urls as well as first child pages.

    http://wordpress.org/extend/plugins/page-links-to/

  8. elsatrento
    Member
    Posted 4 years ago #

    ClaytonJames, you saved my life (I'm terrible with coding...)! Thank you very much!
    Darttiglao, thanks to you too, you've been very kind :)

  9. ClaytonJames
    Member
    Posted 4 years ago #

    You're welcome.

  10. elsatrento
    Member
    Posted 4 years ago #

    Wait, I forgot the "Home" button! That one doesn't figure out as page, and I like the icon the theme uses. I need to modify just that one. So, Darttinglao, I have to write that line you suggested me, substituing "yoururladdress" with the home blog page, and "your static link" with the address of my real home page. Is that right?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags