WordPress.org

Ready to get started?Download WordPress

Forums

Problem displaying links on WP "page" (9 posts)

  1. oncidium
    Member
    Posted 8 years ago #

    I have a WP page, ID=92 set up to display a list of blogs. I would like the links I have in blogroll (id=1) listed on this page. Here is the code I have tried:

    <li id="blogroll">

      < ?php wp_get_links(1); ?>

    The display on the page ends up:
    Blogs
    #
    < ?php wp_get_links(1); ?>
    Edit

    Just shows the code, not the blogroll list.

    I have the page set to use the default template and in the links section, visible is set to "yes". Is it possible I need a different template in order to do this, or do I just have the coding wrong?

    Thanks!

  2. Michael Bishop

    Posted 8 years ago #

    You either need to add that code directly to the template, or install a plugin that allows for php in Pages.
    I suggest copying the links.php template from the default theme into the current theme you are using, and trying that (It has the code "hard-wired" into the template.

  3. techwench
    Member
    Posted 8 years ago #

    I use PHP Exec on my site.

    I've tried other php plugins like RunPHP, but never worked quite right.

    But by default, WP strips the code and converts characters so you can't execute php within posts...which is a good idea in a way, especially if you have multiple authors...and one (or more) decide they don't like you anymore, and post some nasty scripts...

    If you're going to use one of these plugins, just make sure you can absolutely trust all of your authors (better yet, if you're the only author).

  4. oncidium
    Member
    Posted 8 years ago #

    In the theme directory I am currently using, I have a template_archives and template_list but no default. When I am in the WP dashboard on page...it has me choose archive, links or default for "Page Template". How would I be able to edit the default template when it is not showing up? I am using the default template for other pages adn is has header, sidebar, etc. but I just put the direct html code in the page content area for those (not trying to call links)

  5. Michael Bishop

    Posted 8 years ago #

    When you write page, just choose the link template, and create the page, and it will automatically create a page of links for you.

  6. oncidium
    Member
    Posted 8 years ago #

    Thanks for the help everyone!

    Miklb...true, but it seemed to list all the links...not just specific ones.

    Techwench...thanks! I just installed PHP Exec and it works perfectly.

  7. Michael Bishop

    Posted 8 years ago #

    You can edit the links.php file and the template tag to define what links are listed and how you want them listed.
    http://codex.wordpress.org/Template_Tags
    http://codex.wordpress.org/Template_Tags/get_links
    http://codex.wordpress.org/Pages#Page_Templates

  8. oncidium
    Member
    Posted 8 years ago #

    Thanks for the links, miklb!

  9. oncidium
    Member
    Posted 8 years ago #

    After looking at the codex, I'm not sure I understand how I would get the page to list only one category at a time. Would I need a seperate template page for each?
    For example, a page called book links...only display the links in the category "book links" Then another page called magazine links, only display that category. Would I need a "book" template and a "magazine" template that would over ride the regular "page" template in those instances?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.