Trying to Rename Wp-Signup.php - Menu Item

This is very unclear!

Replace any hardcoded links to wp-signup.php with this function: <?php ust_wpsignup_url(); ?> Within post or page content you can insert the [ust_wpsignup_url] shortcode, usually in the href of a link.

I don't understand how to get my anti-splog shortcode to make a menu item. I read this somewhere but I don't know where to start and how to do this. Anyone can guide me through it?

I read on one of the support posts:
Shorcodes only work in post/page content. If you want a link in your menu then you would have to edit your theme template and use the php template function: ust_singup_url().

I even downloaded shortcode in menu plugin. But when I put the shortcode in, it just displays on the menu bar. But the signup content does not display.

Anyone got a walkthrough for this?

  • Paul
    • The Crimson Coder

    @Jude,

    Thank you very much for this. Could you also be so polite as to tell me how to get the Anti-Splog function as a menu item:

    <?php ust_wpsignup_url(); ?>

    I am not sure what I need to edit on the menu shortcode to make a simple menu item, but I am trying to work it out. So this information will help me get started.
    Shortcode:

    add_filter( 'wp_nav_menu_items', 'your_custom_menu_item', 10, 2 );
    
    function your_custom_menu_item ( $items, $args ) {
        if (is_single() && $args->theme_location == 'primary') {
            $items .= '<li>Show whatever</li>';
        }
        return $items;
    }

    Again, thank you or anyone who can help.

    Paul

  • Paul
    • The Crimson Coder

    @Jude,

    Thank you so much for helping me with this.
    I have copied and pasted the function in my Mu-Plugins.

    I know it is a very newb question, but what do I need to edit on the code for it to work on my site/theme if any?

    add_filter( 'wp_nav_menu_items', 'your_custom_menu_item', 10, 2 );
    
    function your_custom_menu_item ( $items, $args ) {
        if (is_single() && $args->theme_location == 'primary') {
            $link = ust_wpsignup_url();
            $items .= '<li>' .$link .'</li>';
        }
        return $items;
    }

    Thank you for any help. I am not sure but it seems I might need to name it or add my theme name to it, but when I attempt any mods to the code I either get errors or it does not display as it does with no mods. It says Theme_location is that general information for the code or intended for me to specify? #Still learning all of this.

    Kindly,

    Paul

  • Paul
    • The Crimson Coder

    Okay,

    I'll take a simple button. Anyone know how to make the Anti-Splog plugin - Rename wp-signup.php feature into a button? "That works".

    If I can't get it to be a menu item (which seems impossible even looking through all the other people who have tried and are trying).

    Can I get some help turning the shortcode or code into a button? The rename works fine but there is minimal use for displaying the url on a page as content my members have to highlight, copy and paste into their url to use it.

    Any Button ideas for this shortcode out there?

    Most kindly,

    me.

  • Jude
    • DEV MAN

    Hey Paul

    I can do this for you, as a valued member you should not have to go back and forth so many times.

    Just please give me exact details on where and how you want the link in your menu with urls.

    Can you please send in

    Subject: "Attn: Jude Rosario"
    - WordPress super admin/ admin username + password
    - FTP credentials (host/username/password)
    - cPanel details

    -link back to this thread for reference

    Select "I have a different question" for your topic - this and the subject line ensure that it gets assigned to me :slight_smile:

    https://premium.wpmudev.org/contact/

    Cheers
    Jude

  • Jude
    • DEV MAN

    Hey Paul the credentials did not work for me. Anyhoo after brainstorming a bit I figured out there is a way to do this after all.

    function custom_rewrite_register() {
      add_rewrite_rule('(.*)iwantin$', ust_wpsignup_url() , 'top');
    }
    add_action('init', 'custom_rewrite_register');

    Just copy/paste the code into the functions.php file of your child theme or a site specific plugin if you use one.

    Now you can share this URL with anyone you want

    http://mysite.com/iwantin

    Will be happy to set that up for you if you need help.

    Jude

  • Paul
    • The Crimson Coder

    Hi @Jude,

    Thank you very much for your reply and code. Unfortunately the code did not work. I placed it within a MU-plugin and it activated fine however it caused the hidden changed wp-signup.php url from AntiSplog to show up at the top of the page (above the header).

    And when I go to http://mysite.com/iwantin - nothing happens.

    Is it possible to turn it into an registered menu item/link?

    Kindly,

    Paul

  • Jude
    • DEV MAN

    Hey Paul

    Is it possible to turn it into an registered menu item/link?

    This is not possible. It would defeat the purpose of the whole Anti Splog link scramble.

    You can try with my updated code below

    function custom_rewrite_register() {
    	$url = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] ;
    	if ( preg_match( 'iwantin' , $url )
    		wp_redirect( ust_url() );
    }
    
    add_action('init', 'custom_rewrite_register');

    Cheers
    Jude

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.