# Running custom php script

**URL:** <https://forum.pinegrow.com/t/running-custom-php-script/280>\
**Category:** WP Starter Theme\
**Created:** [October 17, 2016, 6:06pm UTC](https://forum.pinegrow.com/t/running-custom-php-script/280 "2016-10-17T18:06:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![24degrees](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/24degrees/32/136_2.png) [@24degrees](https://forum.pinegrow.com/u/24degrees)\
**Post date:** [October 17, 2016, 6:06pm UTC](https://forum.pinegrow.com/t/running-custom-php-script/280/1 "2016-10-17T18:06:11Z")

</div>

Hello everyone,

I have obtained this script:

```
/**
 * SWAP THE LOGIN/LOGOUT LABELS WITH ICONS
 * this will apply to any login/logout link which is built using wp_loginout()
 * remember to ensure that 'Login' and 'Logout' in the function are the same labels used in your theme
 *
 * @param	$link	{string}	html string of the link (must be returned to the filter)
 *
 * Author: Andrea Piccart
 * Author Uri: http://bespokewebdeveloper.com
 */

add_filter( 'loginout', 'bwd_use_icon_on_loginout_link');

function bwd_use_icon_on_loginout_link( $link ){
	// if user is logged in
	if ( is_user_logged_in() ){
		$link = str_replace( '<i class="fa fa-sign-out"></i>', 'Logout', $link );
    echo "running logout";
	}
	else { // if user is not logged in
		$link = str_replace( '<i class="fa fa-sign-in"></i>', 'Login', $link );
    echo "running login";
	}
	// return the link
	return $link;
}

```

But, if I call it from the login logout function within PineGrow, it doesn’t replace the text by icons?

 ![](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/1X/792e612bdf5e8d469f46c9772c1658fb194f8dfa.png)

Anyone has any idea why it isn’t working?

Thanks!

kind regards,

Michael

---

<div class="post-metadata">

**Author:** ![Rob](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/rob/32/9_2.png) [@Rob](https://forum.pinegrow.com/u/Rob)\
**Post date:** [October 18, 2016, 9:45pm UTC](https://forum.pinegrow.com/t/running-custom-php-script/280/2 "2016-10-18T21:45:02Z")

</div>

@24degrees I haven’t tried it but is it a possibility that it should be added to the functions.php file.

---

<div class="post-metadata">

**Author:** ![24degrees](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/24degrees/32/136_2.png) [@24degrees](https://forum.pinegrow.com/u/24degrees)\
**Post date:** [October 19, 2016, 6:55am UTC](https://forum.pinegrow.com/t/running-custom-php-script/280/3 "2016-10-19T06:55:36Z")

</div>

I have added the code to the functions.php file. I also added an ‘echo command’ to see if the function ‘loops through’ and it actually does.
