php - strip http:// from the_author_url() -


मैं इसके लिए http: // से कैसे छुटकारा पा सकता हूं:

  & lt; A href = "& lt;? Php the_author_url ();? & Gt;" & gt; & lt;? Php the_author_url ()); ? & Gt; & lt; / a & gt;  

मैंने इसे करने की कोशिश की है:

  & lt; a href = "& lt;? Php the_author_url ();? & Gt;" gt; & Lt;? Php $ url = the_author_url (); $ Url = substr ($ url, 0,6); Echo $ url; ? & Gt; & Lt; / a & gt;  

लेकिन इसका कोई प्रभाव नहीं पड़ा ...

The_author_meta () काम नहीं करेगा, क्योंकि उस फ़ंक्शन गूंज es परिणाम है इसके बजाय, आपको get_the_author_meta ('user_url') , जो वापसी s यूआरएल का उपयोग करना है।

  & lt; a href = "& lt ;; Php the_author_meta ('user_url');? & Gt; "& gt; & Lt;? Php echo str_replace ('http: //', '', get_the_author_meta ('user_url')); ? & Gt; & Lt; / a & gt;  

ध्यान दें कि यह https यूआरएल के लिए खाता नहीं है (यदि आवश्यक हो, तो आप इसके लिए फ़ंक्शन की जगह regex का उपयोग कर सकते हैं)।


Comments

Popular posts from this blog

c# - SignalR: "Protocol error: Unknown transport." when navigating to hub -

Camel ProducerTemplate possible memory leak -

javascript - Adhering to a max length setting with jshint -