php _e question

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I have some code within an ecommerce shop that i'm using as follows

<?php _e( 'No products were found matching your selection.', 'woocommerce' ); ?></p>

Is it possible to replace the 'No products were found matching your selection.'

with text, a hyperlink and an image?

I just want to format the message better and offer a link to somewhere else.

If so could someone tell me how please.


Re: php _e question wrote:

Quoted text here. Click to load it

Well, why don't you try it out?

Quoted text here. Click to load it

As the question might be rather WooCommerce specific, have you
considered asking on < ?

Christoph M. Becker

Re: php _e question

Seriously... because you read a word "woocommerce" it automatically presume i should ask a PHP related question on that forum...

This question has nothing to do with woocommerce it is PHP code

If you don't know the answer then please do not reply... this may sound harsh but I help out on a awful lot of forums and there is nothing worse that comments that are of no relevance or help.

Re: php _e question

Quoted text here. Click to load it

This is not really a PHP question.

Quoted text here. Click to load it

You should do something like:

<p><?php _e ('Some text <a href="http://hostname/path/to/page">click
here</a> <img src="http://hostname/path/to/image">', 'woocommerce' );

You haven't told us what _e is or does, and you'll note that everything
I put in there is HTML and not PHP. Neither have you told us what you
want the resulting message to look like - not that this makes your
question anything more to do with PHP.

"I am enclosing two tickets to the first night of my new play; bring a
friend.... if you have one." - GB Shaw to Churchill "Cannot possibly
attend first night, will attend second...  if there is one." - Winston
Churchill, in response.

Re: php _e question

On 1/10/2015 2:18 PM, wrote:
Quoted text here. Click to load it

This has EVERYTHING to do with woocommerce.  The call is a function call
in woocommerce, and we have no idea what it does.

When working with a package, your best best is to work with the support
forums for that package.  They know their product (and PHP code) better
than anyone else.

If you can't ask in the right place, don't bother asking here.  With
that kind of attitude, you won't find anyone willing to volunteer to
assist you.

Remove the "x" from my email address
Jerry Stuckle

Re: php _e question

On 1/10/15 1:09 PM, wrote:
Quoted text here. Click to load it

A quick check on Google tells me that this looks like a Wordpress  
function _e which is used to echo strings out with possible localization  

I am not familiar enough with Wordpress to give advice on the limits of  
the _e function, but as other have said, you could just give it a shot  
to add the link.

There may be tools in Wordpress to help build such a link/image, and it  
might even be required to use them (depends where the sanitation line is  
in Wordpress, good CMS's will sanitize input from the user to the output  
page safe from attacks).

Re: php _e question

Thanks Tim,
That was just wanted i needed to know.

All resolved now thanks

Re: php _e question

On Sat, 10 Jan 2015 10:09:35 -0800, pigsfoot.trotter wrote:

Quoted text here. Click to load it

Without knowing what the _e function does (it's not core php, so  
presumably it's part of some library, either woocommerce itself or  
whatever woocommerce is built on top of) this is impossible to answer.

Perhaps someone in a woocommerce forum can tell you what sort of data is  
allowable as parameters to _e()

Denis McMahon,

Re: php _e question schrieb am 2015-01-10 um 19:09:
Quoted text here. Click to load it

Well - this is not really PHP specific but more a WordPress questions,
as Woocommerce is based on WordPress.

You can just put the required stuff in there, but don't forget to update
the translation as well (the respectiv PO/MO files) if English is not
the only language you use (I recommend using the Loco Translate plugin
for doing this in the WordPress backend):

<?php _e( 'No products were found matching your selection. <a
href="someurl">Here you find something else</a> <img src="foobar" alt=""
/>', 'woocommerce' ); ?></p>


_e() is a function provided by WordPress to output translation of a text
defined by the - either it will use the given text itself (literally -
so take care not to create invalid HTML with the text) or the
translation for the current language of the site if available.

Also see: <

Arno Welzel

Site Timeline