Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to create custom function for functions.php

  • @dono12

    Participant

    Can any one tell me the proper way to place this in a function so I don’t lose it the next time WordPress updates. The location of this function is in word[press general-template.php. I’ve customized the login widget to redirect usr to Buddypress User Profile.

    CODE IN GENERAL TEMPLATE

    function wp_register( $before = '<li>', $after = '</li>', $echo = true ) {
    	if ( ! is_user_logged_in() ) {
    		if ( get_option('users_can_register') )
    			$link = $before . '<a href="' . esc_url( wp_registration_url() ) . '">' . __('Register') . '</a>' . $after;
    		else
    			$link = '';
    	} else {
    
    $link = $before . '  <a href="' . bp_loggedin_user_domain('/') . '">' . __('User Profile', 'buddypress') . '</a>' . $after;
    	}
Viewing 1 replies (of 1 total)
  • @henrywright

    Moderator

    Please wrap code in backticks when pasting into a post. It helps format it so it’s easily readable.

Viewing 1 replies (of 1 total)
  • The topic ‘How to create custom function for functions.php’ is closed to new replies.
Skip to toolbar