Jump to content

split variables and assign


totallytech
Go to solution Solved by requinix,

Recommended Posts

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?

Link to comment
Share on other sites

  • Solution

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 );
Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.