Ready to get started?Download WordPress


wp_list_pages only display hyperlink (7 posts)

  1. surpher
    Posted 5 years ago #


    This might be obvious but I just can't seem to figure it out. The function wp_list_categories() has a cute little attribute style where you can define it as list or none.

    Though I need this functionality with wp_list_pages() where I need to echo only the link and link text to only one page. 'title_li=&include=83&echo=0' all that I know about and I'm making use of. It just bothers me that I can't remove the < li class="page_item page-item-*XY*"> and < /li> in a simple way.

    Anyone has a cool solution sitting around?

  2. Mark / t31os
    Posted 5 years ago #

    If you only need one link, then it's proberly better to just use something else... seems a waste to call the function only to output a single link.

    <a href="<?php echo get_permalink(83) ?>"><?php echo get_the_title(83); ?></a>
  3. surpher
    Posted 5 years ago #

    Heh. I knew there was a simpler solution to this booger! It just wasn't obvious enough to me. Thank you very much!

    Though... I have to use this on a multilingual WP instance. I'm using ZdMultiLang plugin and the get_permalink(83) doesn't display the translated title. Any idea?

  4. Mark / t31os
    Posted 5 years ago #

    What functions do you have available for you to translate the text?

  5. surpher
    Posted 5 years ago #

    Uf, I have no idea what functions there are available for translation. I've activated the plug-in and it seems to work. When I use wp_get_categories('include=15&list_li=&style=none') it displays the translated name of the category.

    What the ZdMultiLang plug-in does, at least what I've noticed on the high level, is the URL rewrite where it inserts /en/ or /sl/ right after the domain and before the rest of the permalink. And I guess the apply_filters then somehow retrieves the correct language instance of the category name/title. But this doesn't work with pages.

    Tnx for your help.

  6. Mark / t31os
    Posted 5 years ago #

    Rather then me sifting through plugin code to figure how the plugin handles translating text, i'd suggest having a chat with the plugin author, you can even give the above code as an example.

    I don't use any language related functions to know the correct procedure, nor am i familiar with the above plugin, else i'd happily post how to do it.

    Sorry i couldn't be more help, i did check the plugin's instructions and couldn't find anything useful there.

  7. surpher
    Posted 5 years ago #

    No worries. You've been a great help.
    When I figure out the best solution to this problem I will try and remember to post it here.

    Happy wpressin'!

Topic Closed

This topic has been closed to new replies.

About this Topic