Remove MENU ITEM link

This support request was posted in BBQ by sketch2uk

Request ID #1073 Resolved
  • Hello, is it possible to remove the link on the menu items so there are no individual pages for items?

    Juanfra Aldasoro

    Hello there,

    Yes – It is possible. You need to edit some files: template-menu.php and template-menu-list.php

    template-menu.php

    Look for line #70 and remove the a tag:

    echo ‘<li><div><span><a href=”‘ . get_permalink( $post->ID ) . ‘”>’ . get_the_title() . ‘</a></span>’ . “\n”;

    Should look like this:

    echo ‘<li><div><span>’ . get_the_title() . ‘</span>’ . “\n”;

    and line #111 the same:

    echo ‘<div><span><a href=”‘ . get_permalink( $post-&gt;ID ) . ‘”>’ . get_the_title() . ‘</a></span>’ . “\n”;

    Should look like this:

    echo ‘<div><span>’ . get_the_title() . ‘</span>’ . “\n”;

    (If your menu have images you’ll need to remove links from there too)

    template-menu-list.php

    Line #77 looks like this:
    echo ‘<li><div><span><a name=”menu-item-‘ . $post->ID . ‘” href=”‘ . get_permalink( $post->ID ) . ‘”>’ . get_the_title() . ‘</a></span>’ . “\n”;

    Should look like this:
    echo ‘<li><div><span><a name=”menu-item-‘ . $post->ID . ‘” >’ . get_the_title() . ‘</a></span>’ . “\n”;

    And line #128, the same:

    echo ‘<div><span><a name=”menu-item-‘ . $post->ID . ‘” href=”‘ . get_permalink( $post->ID ) . ‘”>’ . get_the_title() . ‘</a></span>’ . “\n”;

    Should look like this:
    echo ‘<div><span><a name=”menu-item-‘ . $post->ID . ‘” >’ . get_the_title() . ‘</a></span>’ . “\n”;

    Best,
    Juan.

Viewing 2 posts - 1 through 2 (of 2 total)

This topic is marked as resolved

Only the topic author can re-open this thread.

Login to your Account

Welcome back! Please log in to your account by filling the fields below:

Forgot?

Not a member? Create a free account.

Create a Free Account

You're 27 seconds away from some awesome WordPress free stuff, benefits and more. Create a free account and have access to our free products, benefits and more!

Already have an account? Log in
Secure Server