totallytech Posted May 9, 2015 Share Posted May 9, 2015 Hey, I've have a tiny little piece of code, which currently looks like: <?php printf( '<span class="cart-link"><a href="%1$s" title="%2$s">%3$s</a></span>', esc_url( $ImStore->get_permalink( "shopping-cart", true, false, $post->post_parent ) ), esc_attr__( 'Link to shopping cart', 'ims' ), __( 'Cart', 'ims' ) ?> which generates an href with the url to the shopping cart in. How would I strip out the url - so I just end up with echo "http://mystore.com/cart"; and nothing around it? Quote Link to comment https://forums.phpfreaks.com/topic/296166-split-variables-and-assign/ Share on other sites More sharing options...
Solution requinix Posted May 9, 2015 Solution Share Posted May 9, 2015 I suggest actually learning PHP so you'll understand what the code is doing and can figure out answers like "remove the parts you don't want" on your own. echo $ImStore->get_permalink( "shopping-cart", true, false, $post->post_parent ); Quote Link to comment https://forums.phpfreaks.com/topic/296166-split-variables-and-assign/#findComment-1511250 Share on other sites More sharing options...
totallytech Posted May 9, 2015 Author Share Posted May 9, 2015 Thank you. I used to code in php about 6 years ago but admittedly basic php - I'm now retraining but I'm just editing someone elses code at the moment and I've got really lazy and even the really obvious stuff looks hard now... . Thanks for the help Quote Link to comment https://forums.phpfreaks.com/topic/296166-split-variables-and-assign/#findComment-1511251 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.