ThemeShaper Forums » Thematic

[closed]

External links as menu items

(13 posts)
  • Started 6 years ago by josswinn
  • Latest reply from Chris
  • This topic is resolved

Tags:

  1. josswinn
    Member

    Hello,

    I'm in the process of setting up Thematic for a site and would like to have a couple of menu items that link off to external sites, just as the Themeshaper sites has a link to this forum: http://themeshaper.com/thematic-for-wordpress/

    By default, the menu items are internal pages.

    Can anyone help?

    Thank you
    Joss

    Posted 6 years ago #
  2. How I used a WordPress Child Theme To Redesign My Blog The Smart Way has the answer.

    Try using something like

    function childtheme_menu() { ?>
    <div id="menu">
    <ul>
    	<li class="<?php if ( is_page('about') ) { ?>current_page_item<?php } else { ?>page_item<?php } ?>"><a href="<?php echo get_option('home') ?>/about/" title="About This Blog">About</a></li>
    	<li class="<?php if ( is_page('advertising') ) { ?>current_page_item<?php } else { ?>page_item<?php } ?>"><a href="<?php echo get_option('home') ?>/advertising/" title="Advertise on My Blog">Advertise</a></li>
    	<li class="<?php if ( is_page('contact') ) { ?>current_page_item<?php } else { ?>page_item<?php } ?>"><a href="<?php echo get_option('home') ?>/contact/" title="Contact Me">Contact</a></li>
            <li class="page_item"><a href="" title="" rel="external">Your External Link</li>
    </ul>
    </div>
    
    <?php }
    
    add_filter( 'sandbox_menu', 'childtheme_menu' );

    in the functions.php of your child theme.

    Posted 6 years ago #
  3. josswinn
    Member

    Thanks very much for your quick reply.

    Posted 6 years ago #
  4. josswinn
    Member

    That works. Will send the URL when the site is ready. Thanks very much for thematic and your related tutorials. The 'support' for the theme was one of the reasons I decided to go with it.

    Posted 6 years ago #
  5. Hi,

    I also wanted to know how to do exactly that. I have added the code to to the acamas function.php but nothing happened, the menu stayed axactly the same.

    Posted 5 years ago #
  6. This plug in makes pages link to urls - http://txfx.net/code/wordpress/page-links-to/

    Posted 5 years ago #
  7. add_filter( 'sandbox_menu', 'childtheme_menu' );

    Hello, I'm also trying to add external links to my menu (childtheme) and so checked out this thread. I've tried adding this, as is, and also changing 'sandbox' to 'thematic', with no results showing up. Theoretically, what I'd like is something like the default 'home' link doohicky, where you could add your external links to the menu, after the pages are listed. That way, every external link I wanted to add could just be added that way, by itself? Is that possible? I'm still such a noob when it comes to playing with this.

    thanks in advance :)
    E.

    Posted 4 years ago #
  8. I think the code up there does not to the current version of thematic (0.9.5.1) The current version uses wp_page_menu() in the thamatic_access() so try filtering wp_page_menu() like so:

    function child_add_menu_items($output) {
    	$my_code = '<li><a>my link 1</a></li><li><a>my link 2</a></li></ul>';
    	return str_replace('</ul>',$my_code, $output);
    }
    add_filter('wp_page_menu','child_add_menu_items');
    Posted 4 years ago #
  9. I think the code up there does not to the current version of thematic (0.9.5.1) The current version uses wp_page_menu() in the thamatic_access() so try filtering wp_page_menu() like so:

    function child_add_menu_items($output) {
    	$my_code = '<li><a>my link 1</a></li><li><a>my link 2</a></li></ul>';
    	return str_replace('</ul>',$my_code, $output);
    }
    add_filter('wp_page_menu','child_add_menu_items');
    Posted 4 years ago #
  10. that's perfect! and exactly what I needed :D Thanks so much :D

    Posted 4 years ago #
  11. Thanks that worked for me too. Just don't forget the menu link needs a page to go to

    $my_code = '<li<a href="http://www.besthealthsupplies.com/magento/index.php/">Store</a></li></ul>';

    Posted 4 years ago #
  12. Thanks, Works well. Anyone know how to put the menu items in front of the wordpress pages items?

    Posted 4 years ago #
  13. stengl
    Member

    I want to add external links as describe by Ian not in the menu, but on the pages widget (in the right sidebar). Any idea how to do that?

    Posted 4 years ago #
  14. Create your own Page Widget :)

    Take a look here: http://wpengineer.com/wordpress-built-a-widget/

    Chris

    Posted 4 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.