icl_link_to_element and icl_object_id

Example usage

Example Purpose Produced HTML
<?php icl_link_to_element(10); ?> Link to page 10 (support page) <a href=”/support/”>Support</a>
<?php icl_link_to_element(10,’post’,__(‘Get help’)); ?> Link to support page with an alternative link text <a href=”/support/”>Get help</a>
<?php icl_link_to_element(10,’post’,false, array(‘category’=>’products’,’priority’=>’high’); ?> Link to support page and add two arguments <a href=”/support/?category=products&amp;priority=high”>Support</a>
<?php icl_link_to_element(10,’post’,false,’priority’=>’high’,’faq’); ?>
<?php icl_link_to_element(3,’tag’); ?> Link to tag with ID 3 (our ‘News’ tag) <a href=”/tag/news/”>News</a>

 

icl_link_to_element 可以以自动生成对应翻译页面的链接,但是不能给链接加上 自己想要的 class 或者 id

可以使用这样的方法:

<a href=”<?php echo get_permalink(icl_object_id(338, ‘page’, true)) ?>”><?php echo get_the_title(‘338’); ?></a>

10,160 thoughts on “icl_link_to_element and icl_object_id

  1. just click the up coming article

    Hello I am so delighted I found your webpage, I really found
    you by mistake, while I was searching on Yahoo for something else, Regardless I am here now and would just like to
    say kudos for a incredible post and a all round exciting
    blog (I also love the theme/design), I don’t have time to read it all at the moment but I have book-marked it and also added your RSS feeds, so when I have time I will be back to read a great deal more,
    Please do keep up the great work. http://Grigorenko-Sv.Pp.ua/user/AstridAndes576/

  2. Stephanie Etter

    Howdy! I understand this is somewhat off-topic but I needed to ask. Does managing a well-established website such as yours require a massive amount work? I’m completely new to writing a blog however I do write in my journal on a daily basis. I’d like to start a blog so I can easily share my own experience and views online. Please let me know if you have any kind of recommendations or tips for brand new aspiring blog owners. Thankyou!

  3. Giovanna Santos

    Hello! I could have sworn I’ve visited this
    web site before but after going through some of the posts I realized it’s new to me.
    Regardless, I’m certainly pleased I discovered it and I’ll be book-marking it and checking back
    regularly!

发表评论