Random page title with link (2 posts)

  1. robinvd
    Posted 5 years ago #

    Hey all,

    Thanks to the new beta I'm a bit confused what to do:

    My website was in beta 1 fully pages, all menu's worked but I was looking for a way to show 1 random page title + link. Eventually this was impossible somehow.. so I changed all my pages into posts.

    Now beta 2 has screwed my menu, No posts can be added as a child under a category parent. So now I need to change back all content to pages again just to let my menu work.

    So.. Is it possible to random one page title? Or should I stay with posts wich I can't use in my main menu.. Please help?!

  2. vtxyzzy
    Posted 5 years ago #

    The code snippet below will show one random page title:

    $args = array('post_type' => 'page',
       'posts_per_page' => 1,
       'orderby' => 'rand',
    if (have_posts()) {
       while (have_posts()) { the_post();

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.